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():
21
21
bad_src = "obbledygobbledygook"
22
22
with pytest .raises (RuntimeError ): create_function_from_source (bad_src )
23
23
24
+ def _print_statement ():
25
+ try :
26
+ exec ('print ""' )
27
+ return True
28
+ except SyntaxError :
29
+ return False
30
+
24
31
@pytest .mark .skipif (sys .version_info [0 ] > 2 , reason = "breaks python 3" )
25
32
def test_func_py2 ():
26
33
def is_string ():
27
34
return isinstance ('string' , str )
28
35
29
- def print_statement ():
30
- # test python 2 compatibility
31
- try :
32
- exec ('print ""' )
33
- return True
34
- except SyntaxError :
35
- return False
36
-
37
36
wrapped_func = create_function_from_source (getsource (is_string ))
38
37
assert is_string () == wrapped_func ()
39
38
40
- wrapped_func2 = create_function_from_source (getsource (print_statement ))
39
+ wrapped_func2 = create_function_from_source (getsource (_print_statement ))
41
40
assert wrapped_func2 ()
You can’t perform that action at this time.
0 commit comments