@@ -89,25 +89,25 @@ def test_repr(self, monkeypatch):
8989 f = Frame (0 )
9090 monkeypatch .setattr (Frame , "serialize_body" , lambda _ : b"body" )
9191 assert repr (f ) == (
92- "Frame(stream_id: 0; flags: None ): 626f6479"
92+ "Frame(stream_id=0, flags=[] ): <hex: 626f6479> "
9393 )
9494
9595 f .stream_id = 42
9696 f .flags = ["END_STREAM" , "PADDED" ]
9797 assert repr (f ) == (
98- "Frame(stream_id: 42; flags: END_STREAM, PADDED): 626f6479"
98+ "Frame(stream_id=42, flags=[' END_STREAM', ' PADDED'] ): <hex: 626f6479> "
9999 )
100100
101101 monkeypatch .setattr (Frame , "serialize_body" , lambda _ : b"A" * 25 )
102102 assert repr (f ) == (
103- "Frame(stream_id: 42; flags: END_STREAM, PADDED): {}..." .format ("41" * 10 )
103+ "Frame(stream_id=42, flags=[' END_STREAM', ' PADDED'] ): <hex: {}...> " .format ("41" * 10 )
104104 )
105105
106106 def test_frame_explain (self , capsys ):
107107 d = b'\x00 \x00 \x08 \x00 \x01 \x00 \x00 \x00 \x01 testdata'
108108 Frame .explain (memoryview (d ))
109109 captured = capsys .readouterr ()
110- assert captured .out .strip () == "DataFrame(stream_id: 1; flags: END_STREAM): 7465737464617461"
110+ assert captured .out .strip () == "DataFrame(stream_id=1, flags=[' END_STREAM'] ): <hex: 7465737464617461> "
111111
112112 def test_cannot_parse_invalid_frame_header (self ):
113113 with pytest .raises (InvalidFrameError ):
@@ -122,7 +122,7 @@ class TestDataFrame:
122122
123123 def test_repr (self ):
124124 f = DataFrame (1 , b"testdata" )
125- assert repr (f ).endswith ("7465737464617461" )
125+ assert repr (f ).endswith ("<hex: 7465737464617461> " )
126126
127127 def test_data_frame_has_correct_flags (self ):
128128 f = DataFrame (1 )
@@ -251,11 +251,11 @@ class TestPriorityFrame:
251251
252252 def test_repr (self ):
253253 f = PriorityFrame (1 )
254- assert repr (f ).endswith ("exclusive: False, depends_on: 0, stream_weight: 0" )
254+ assert repr (f ).endswith ("exclusive= False, depends_on= 0, stream_weight= 0" )
255255 f .exclusive = True
256256 f .depends_on = 0x04
257257 f .stream_weight = 64
258- assert repr (f ).endswith ("exclusive: True, depends_on: 4, stream_weight: 64" )
258+ assert repr (f ).endswith ("exclusive= True, depends_on= 4, stream_weight= 64" )
259259
260260 def test_priority_frame_has_no_flags (self ):
261261 f = PriorityFrame (1 )
@@ -306,9 +306,9 @@ def test_short_priority_frame_errors(self):
306306class TestRstStreamFrame :
307307 def test_repr (self ):
308308 f = RstStreamFrame (1 )
309- assert repr (f ).endswith ("error_code: 0" )
309+ assert repr (f ).endswith ("error_code= 0" )
310310 f .error_code = 420
311- assert repr (f ).endswith ("error_code: 420" )
311+ assert repr (f ).endswith ("error_code= 420" )
312312
313313 def test_rst_stream_frame_has_no_flags (self ):
314314 f = RstStreamFrame (1 )
@@ -366,9 +366,9 @@ class TestSettingsFrame:
366366
367367 def test_repr (self ):
368368 f = SettingsFrame ()
369- assert repr (f ).endswith ("settings: {}" )
369+ assert repr (f ).endswith ("settings= {}" )
370370 f .settings [SettingsFrame .MAX_FRAME_SIZE ] = 16384
371- assert repr (f ).endswith ("settings: {5: 16384}" )
371+ assert repr (f ).endswith ("settings= {5: 16384}" )
372372
373373 def test_settings_frame_has_only_one_flag (self ):
374374 f = SettingsFrame ()
@@ -431,10 +431,10 @@ def test_short_settings_frame_errors(self):
431431class TestPushPromiseFrame :
432432 def test_repr (self ):
433433 f = PushPromiseFrame (1 )
434- assert repr (f ).endswith ("promised_stream_id: 0, data: None" )
434+ assert repr (f ).endswith ("promised_stream_id= 0, data= None" )
435435 f .promised_stream_id = 4
436436 f .data = b"testdata"
437- assert repr (f ).endswith ("promised_stream_id: 4, data: 7465737464617461" )
437+ assert repr (f ).endswith ("promised_stream_id= 4, data=<hex: 7465737464617461> " )
438438
439439 def test_push_promise_frame_flags (self ):
440440 f = PushPromiseFrame (1 )
@@ -523,9 +523,9 @@ def test_short_push_promise_errors(self):
523523class TestPingFrame :
524524 def test_repr (self ):
525525 f = PingFrame ()
526- assert repr (f ).endswith ("opaque_data: b''" )
526+ assert repr (f ).endswith ("opaque_data= b''" )
527527 f .opaque_data = b'hello'
528- assert repr (f ).endswith ("opaque_data: b'hello'" )
528+ assert repr (f ).endswith ("opaque_data= b'hello'" )
529529
530530 def test_ping_frame_has_only_one_flag (self ):
531531 f = PingFrame ()
@@ -581,11 +581,11 @@ def test_ping_frame_has_no_less_than_body_length_8(self):
581581class TestGoAwayFrame :
582582 def test_repr (self ):
583583 f = GoAwayFrame ()
584- assert repr (f ).endswith ("last_stream_id: 0, error_code: 0, additional_data: b''" )
584+ assert repr (f ).endswith ("last_stream_id= 0, error_code= 0, additional_data= b''" )
585585 f .last_stream_id = 64
586586 f .error_code = 32
587587 f .additional_data = b'hello'
588- assert repr (f ).endswith ("last_stream_id: 64, error_code: 32, additional_data: b'hello'" )
588+ assert repr (f ).endswith ("last_stream_id= 64, error_code= 32, additional_data= b'hello'" )
589589
590590 def test_go_away_has_no_flags (self ):
591591 f = GoAwayFrame ()
@@ -652,10 +652,10 @@ def test_short_goaway_frame_errors(self):
652652class TestWindowUpdateFrame :
653653 def test_repr (self ):
654654 f = WindowUpdateFrame (0 )
655- assert repr (f ).endswith ("window_increment: 0" )
655+ assert repr (f ).endswith ("window_increment= 0" )
656656 f .stream_id = 1
657657 f .window_increment = 512
658- assert repr (f ).endswith ("window_increment: 512" )
658+ assert repr (f ).endswith ("window_increment= 512" )
659659
660660 def test_window_update_has_no_flags (self ):
661661 f = WindowUpdateFrame (0 )
@@ -699,12 +699,12 @@ def test_short_windowupdate_frame_errors(self):
699699class TestHeadersFrame :
700700 def test_repr (self ):
701701 f = HeadersFrame (1 )
702- assert repr (f ).endswith ("exclusive: False, depends_on: 0, stream_weight: 0, data: None" )
702+ assert repr (f ).endswith ("exclusive= False, depends_on= 0, stream_weight= 0, data= None" )
703703 f .data = b'hello'
704704 f .exclusive = True
705705 f .depends_on = 42
706706 f .stream_weight = 64
707- assert repr (f ).endswith ("exclusive: True, depends_on: 42, stream_weight: 64, data: 68656c6c6f" )
707+ assert repr (f ).endswith ("exclusive= True, depends_on= 42, stream_weight= 64, data=<hex: 68656c6c6f> " )
708708
709709 def test_headers_frame_flags (self ):
710710 f = HeadersFrame (1 )
@@ -790,9 +790,9 @@ def test_headers_frame_with_no_length_parses(self):
790790class TestContinuationFrame :
791791 def test_repr (self ):
792792 f = ContinuationFrame (1 )
793- assert repr (f ).endswith ("data: None" )
793+ assert repr (f ).endswith ("data= None" )
794794 f .data = b'hello'
795- assert repr (f ).endswith ("data: 68656c6c6f" )
795+ assert repr (f ).endswith ("data=<hex: 68656c6c6f> " )
796796
797797 def test_continuation_frame_flags (self ):
798798 f = ContinuationFrame (1 )
@@ -852,11 +852,11 @@ class TestAltSvcFrame:
852852
853853 def test_repr (self ):
854854 f = AltSvcFrame (0 )
855- assert repr (f ).endswith ("origin: b'', field: b''" )
855+ assert repr (f ).endswith ("origin= b'', field= b''" )
856856 f .field = b'h2="alt.example.com:8000", h2=":443"'
857- assert repr (f ).endswith ("origin: b'', field: b'h2=\" alt.example.com:8000\" , h2=\" :443\" '" )
857+ assert repr (f ).endswith ("origin= b'', field= b'h2=\" alt.example.com:8000\" , h2=\" :443\" '" )
858858 f .origin = b'example.com'
859- assert repr (f ).endswith ("origin: b'example.com', field: b'h2=\" alt.example.com:8000\" , h2=\" :443\" '" )
859+ assert repr (f ).endswith ("origin= b'example.com', field= b'h2=\" alt.example.com:8000\" , h2=\" :443\" '" )
860860
861861 def test_altsvc_frame_flags (self ):
862862 f = AltSvcFrame (0 )
@@ -927,4 +927,4 @@ def test_altsvc_with_unicode_field_fails(self):
927927class TestExtensionFrame :
928928 def test_repr (self ):
929929 f = ExtensionFrame (0xFF , 1 , 42 , b'hello' )
930- assert repr (f ).endswith ("type: 255, flag_byte: 42, body: 68656c6c6f" )
930+ assert repr (f ).endswith ("type= 255, flag_byte= 42, body=<hex: 68656c6c6f> " )
0 commit comments