File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -21,21 +21,20 @@ def test_func_to_str_err():
2121 bad_src = "obbledygobbledygook"
2222 with pytest .raises (RuntimeError ): create_function_from_source (bad_src )
2323
24+ def _print_statement ():
25+ try :
26+ exec ('print ""' )
27+ return True
28+ except SyntaxError :
29+ return False
30+
2431@pytest .mark .skipif (sys .version_info [0 ] > 2 , reason = "breaks python 3" )
2532def test_func_py2 ():
2633 def is_string ():
2734 return isinstance ('string' , str )
2835
29- def print_statement ():
30- # test python 2 compatibility
31- try :
32- exec ('print ""' )
33- return True
34- except SyntaxError :
35- return False
36-
3736 wrapped_func = create_function_from_source (getsource (is_string ))
3837 assert is_string () == wrapped_func ()
3938
40- wrapped_func2 = create_function_from_source (getsource (print_statement ))
39+ wrapped_func2 = create_function_from_source (getsource (_print_statement ))
4140 assert wrapped_func2 ()
You can’t perform that action at this time.
0 commit comments