##// END OF EJS Templates
Older versions render a little less pretty
Philipp A -
Show More
@@ -22,6 +22,7 b' from IPython import get_ipython'
22 from IPython.testing.tools import AssertPrints, AssertNotPrints
22 from IPython.testing.tools import AssertPrints, AssertNotPrints
23 from IPython.utils.path import compress_user
23 from IPython.utils.path import compress_user
24
24
25
25 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
26 # Globals and constants
27 # Globals and constants
27 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
@@ -433,12 +434,12 b' def test_builtin_init():'
433
434
434
435
435 def test_render_signature_short():
436 def test_render_signature_short():
436 def short_fun(a: int = 1): pass
437 def short_fun(a=1): pass
437 sig = oinspect._render_signature(
438 sig = oinspect._render_signature(
438 signature(short_fun),
439 signature(short_fun),
439 short_fun.__name__,
440 short_fun.__name__,
440 )
441 )
441 nt.assert_equal(sig, 'short_fun(a: int = 1)')
442 nt.assert_equal(sig, 'short_fun(a=1)')
442
443
443
444
444 def test_render_signature_long():
445 def test_render_signature_long():
@@ -454,10 +455,20 b' def test_render_signature_long():'
454 signature(long_function),
455 signature(long_function),
455 long_function.__name__,
456 long_function.__name__,
456 )
457 )
457 nt.assert_equal(sig, '''\
458 nt.assert_in(sig, [
459 # Python >=3.7
460 '''\
461 long_function(
462 a_really_long_parameter: int,
463 and_another_long_one: bool = False,
464 let_us_make_sure_this_is_looong: Union[str, NoneType] = None,
465 ) -> bool\
466 ''', # Python <=3.6
467 '''\
458 long_function(
468 long_function(
459 a_really_long_parameter: int,
469 a_really_long_parameter:int,
460 and_another_long_one: bool = False,
470 and_another_long_one:bool=False,
461 let_us_make_sure_this_is_looong: Union[str, NoneType] = None,
471 let_us_make_sure_this_is_looong:Union[str, NoneType]=None,
462 ) -> bool\
472 ) -> bool\
463 ''')
473 ''',
474 ])
General Comments 0
You need to be logged in to leave comments. Login now