diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index b3e2b21..14c7c40 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -22,6 +22,7 @@ from IPython import get_ipython from IPython.testing.tools import AssertPrints, AssertNotPrints from IPython.utils.path import compress_user + #----------------------------------------------------------------------------- # Globals and constants #----------------------------------------------------------------------------- @@ -433,12 +434,12 @@ def test_builtin_init(): def test_render_signature_short(): - def short_fun(a: int = 1): pass + def short_fun(a=1): pass sig = oinspect._render_signature( signature(short_fun), short_fun.__name__, ) - nt.assert_equal(sig, 'short_fun(a: int = 1)') + nt.assert_equal(sig, 'short_fun(a=1)') def test_render_signature_long(): @@ -454,10 +455,20 @@ def test_render_signature_long(): signature(long_function), long_function.__name__, ) - nt.assert_equal(sig, '''\ + nt.assert_in(sig, [ + # Python >=3.7 + '''\ 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\ +''', + ])