From ce77c86df3cef1df5fbd059d258ad314088f8c1c 2023-03-24 09:53:05 From: Matthias Bussonnier Date: 2023-03-24 09:53:05 Subject: [PATCH] explict python version check --- diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index 8ae146f..adbf1d4 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -514,28 +514,20 @@ def test_render_signature_long(): signature(long_function), long_function.__name__, ) - assert sig in [ - # Python >=3.9 - '''\ + if sys.version_info >= (3, 9): + expected = """\ long_function( a_really_long_parameter: int, and_another_long_one: bool = False, let_us_make_sure_this_is_looong: Optional[str] = None, ) -> bool\ -''', - # Python >=3.7 - '''\ +""" + else: + expected = """\ long_function( a_really_long_parameter: int, and_another_long_one: bool = False, let_us_make_sure_this_is_looong: Union[str, NoneType] = None, ) -> bool\ -''', # Python <=3.6 - '''\ -long_function( - a_really_long_parameter:int, - and_another_long_one:bool=False, - let_us_make_sure_this_is_looong:Union[str, NoneType]=None, -) -> bool\ -''', - ] +""" + assert sig == expected