https://github.com/python-hyper/h2/commit/eabe727282e7a7aa3254773292f86cf341bdc597 From eabe727282e7a7aa3254773292f86cf341bdc597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Sun, 3 Jul 2022 12:05:05 +0200 Subject: [PATCH] Fix repr() checks for Python 3.11 In Python 3.11, repr() was modified, this commit fixes the assertions to match the new repr() behavior. Fix #1268 --- a/test/test_events.py +++ b/test/test_events.py @@ -207,11 +207,18 @@ def test_remotesettingschanged_repr(self): ), } - assert repr(e) == ( - "" - ) + if sys.version_info >= (3, 11): + assert repr(e) == ( + "" + ) + else: + assert repr(e) == ( + "" + ) def test_pingreceived_repr(self): """ @@ -249,10 +256,16 @@ def test_streamreset_repr(self): e.error_code = h2.errors.ErrorCodes.ENHANCE_YOUR_CALM e.remote_reset = False - assert repr(e) == ( - "" - ) + if sys.version_info >= (3, 11): + assert repr(e) == ( + "" + ) + else: + assert repr(e) == ( + "" + ) def test_pushedstreamreceived_repr(self): """ @@ -284,11 +297,18 @@ def test_settingsacknowledged_repr(self): ), } - assert repr(e) == ( - "" - ) + if sys.version_info >= (3, 11): + assert repr(e) == ( + "" + ) + else: + assert repr(e) == ( + "" + ) def test_priorityupdated_repr(self): """ @@ -318,10 +338,16 @@ def test_connectionterminated_repr(self, additional_data, data_repr): e.last_stream_id = 33 e.additional_data = additional_data - assert repr(e) == ( - "" % data_repr - ) + if sys.version_info >= (3, 11): + assert repr(e) == ( + "" % data_repr + ) + else: + assert repr(e) == ( + "" % data_repr + ) def test_alternativeserviceavailable_repr(self): """