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 |
|
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 |
|
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_ |
|
458 | nt.assert_in(sig, [ | |
|
459 | # Python >=3.7 | |||
|
460 | '''\ | |||
458 |
|
|
461 | long_function( | |
459 |
|
|
462 | a_really_long_parameter: int, | |
460 |
|
|
463 | and_another_long_one: bool = False, | |
461 |
|
|
464 | let_us_make_sure_this_is_looong: Union[str, NoneType] = None, | |
462 | ) -> bool\ |
|
465 | ) -> bool\ | |
463 | ''') |
|
466 | ''', # Python <=3.6 | |
|
467 | '''\ | |||
|
468 | long_function( | |||
|
469 | a_really_long_parameter:int, | |||
|
470 | and_another_long_one:bool=False, | |||
|
471 | let_us_make_sure_this_is_looong:Union[str, NoneType]=None, | |||
|
472 | ) -> bool\ | |||
|
473 | ''', | |||
|
474 | ]) |
General Comments 0
You need to be logged in to leave comments.
Login now