def test_make_function_with_signature_lineno():
 def crashy_function(*args, **kwargs):
  (1 / 0)
 wrapped = make_function_with_signature(crashy_function, (u'a', u'b'))
 line = u"\n    wrapped = make_function_with_signature(crashy_function, ('a', 'b'))\n    ".strip()
 try:
  wrapped(1, 2)
 except Exception:
  (exc_cls, exc, tb) = sys.exc_info()
  assert (exc_cls is ZeroDivisionError)
  tb_lines = traceback.format_tb(tb)
  assert (u'1 / 0' in tb_lines[(-1)])
  assert ((line in tb_lines[(-2)]) and (u'line =' not in tb_lines[(-2)]))
 else:
  pytest.fail(u'This should have caused an exception')

def test_make_function_with_signature_lineno ( ) : def crashy_function ( * args , ** kwargs ) : ( 1 / 0 ) wrapped = make_function_with_signature ( crashy_function , ( u'a' , u'b' ) ) line = u"\n    wrapped = make_function_with_signature(crashy_function, ('a', 'b'))\n    " . strip ( ) try : wrapped ( 1 , 2 ) except Exception : ( exc_cls , exc , tb ) = sys . exc_info ( ) assert ( exc_cls is ZeroDivisionError ) tb_lines = traceback . format_tb ( tb ) assert ( u'1 / 0' in tb_lines [ ( - 1 ) ] ) assert ( ( line in tb_lines [ ( - 2 ) ] ) and ( u'line =' not in tb_lines [ ( - 2 ) ] ) ) else : pytest . fail ( u'This should have caused an exception' )
tests that a function made with make_function_with_signature is give the correct line number into the module it was created from .