From e0e68ccd6a8007fa9fb50aa7e8432505dc93f7b8 Mon Sep 17 00:00:00 2001 From: FoxMaSk Date: Tue, 5 Sep 2017 22:59:32 +0200 Subject: not pep8 compliant #71 --- tests/__init__.py | 0 tests/test_streaming.py | 17 +++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 tests/__init__.py (limited to 'tests') diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_streaming.py b/tests/test_streaming.py index c79a8e9..1f8d75f 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -24,9 +24,10 @@ class Listener(StreamListener): self.heartbeats += 1 def handle_stream_(self, lines): - '''Test helper to avoid littering all tests with six.b().''' + """Test helper to avoid littering all tests with six.b().""" return self.handle_stream(map(six.b, lines)) + def test_heartbeat(): listener = Listener() listener.handle_stream_([':one', ':two']) @@ -85,7 +86,7 @@ def test_many(events): def test_unknown_event(): - '''Be tolerant of new event types''' + """Be tolerant of new event types""" listener = Listener() listener.handle_stream_([ 'event: blahblah', @@ -137,11 +138,11 @@ def test_sse_order_doesnt_matter(): def test_extra_keys_ignored(): - ''' + """ https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format defines 'id' and 'retry' keys which the Mastodon streaming API doesn't use, and alleges that "All other field names are ignored". - ''' + """ listener = Listener() listener.handle_stream_([ 'event: update', @@ -155,7 +156,7 @@ def test_extra_keys_ignored(): def test_valid_utf8(): - '''Snowman Cat Face With Tears Of Joy''' + """Snowman Cat Face With Tears Of Joy""" listener = Listener() listener.handle_stream_([ 'event: update', @@ -166,7 +167,7 @@ def test_valid_utf8(): def test_invalid_utf8(): - '''Cat Face With Tears O''' + """Cat Face With Tears O""" listener = Listener() with pytest.raises(MalformedEventError): listener.handle_stream_([ @@ -177,13 +178,13 @@ def test_invalid_utf8(): def test_multiline_payload(): - ''' + """ https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Data-only_messages says that newlines in the 'data' field can be encoded by sending the field twice! This would be really pathological for Mastodon because the payload is JSON, but technically literal newlines are permissible (outside strings) so let's handle this case. - ''' + """ listener = Listener() listener.handle_stream_([ 'event: update', -- cgit v1.2.3