@@ -48,59 +48,9 @@ def gfunc():
4848
4949 i .runsource ("gfunc()" )
5050
51- global_not_found = "name 'gfunc' is not defined"
52-
53- if (
54- sys .version_info [:2 ] == (3 , 13 )
55- and sys .version_info [:3 ] >= (3 , 13 , 12 )
56- ) or sys .version_info [:3 ] >= (3 , 14 , 3 ):
57- expected = expected = (
58- "Traceback (most recent call last):\n File "
59- + green ('"<input>"' )
60- + ", line "
61- + bold (magenta ("1" ))
62- + ", in "
63- + cyan ("<module>" )
64- + "\n "
65- + bold (red ("NameError" ))
66- + ": "
67- + cyan (global_not_found )
68- + "\n "
69- )
70- elif (3 , 13 ) <= sys .version_info [:2 ] or pypy :
71- expected = (
72- "Traceback (most recent call last):\n File "
73- + green ('"<input>"' )
74- + ", line "
75- + bold (magenta ("1" ))
76- + ", in "
77- + cyan ("<module>" )
78- + "\n gfunc()"
79- + "\n ^^^^^\n "
80- + bold (red ("NameError" ))
81- + ": "
82- + cyan (global_not_found )
83- + "\n "
84- )
85- else :
86- expected = (
87- "Traceback (most recent call last):\n File "
88- + green ('"<input>"' )
89- + ", line "
90- + bold (magenta ("1" ))
91- + ", in "
92- + cyan ("<module>" )
93- + "\n gfunc()"
94- + "\n ^^^^^\n "
95- + bold (red ("NameError" ))
96- + ": "
97- + cyan (global_not_found )
98- + "\n "
99- )
100-
101- a = i .a
102- self .assertMultiLineEqual (str (expected ), str (plain ("" ).join (a )))
103- self .assertEqual (expected , plain ("" ).join (a ))
51+ a = str (plain ("" ).join (i .a ))
52+ self .assertIn ("name 'gfunc' is not defined" , a )
53+ self .assertIn ("NameErro" , a )
10454
10555 def test_getsource_works_on_interactively_defined_functions (self ):
10656 source = "def foo(x):\n return x + 1\n "
0 commit comments