@@ -62,20 +62,20 @@ def test_traceback(self):
62
62
def f ():
63
63
return 1 / 0
64
64
65
- def g ():
65
+ def gfunc ():
66
66
return f ()
67
67
68
- i .runsource ('g ()' )
68
+ i .runsource ('gfunc ()' )
69
69
70
70
if pypy :
71
- global_not_found = "global name 'g ' is not defined"
71
+ global_not_found = "global name 'gfunc ' is not defined"
72
72
else :
73
- global_not_found = "name 'g ' is not defined"
73
+ global_not_found = "name 'gfunc ' is not defined"
74
74
75
75
expected = (
76
76
'Traceback (most recent call last):\n File ' +
77
77
green ('"<input>"' ) + ', line ' +
78
- bold (magenta ('1' )) + ', in ' + cyan ('<module>' ) + '\n g ()\n ' +
78
+ bold (magenta ('1' )) + ', in ' + cyan ('<module>' ) + '\n gfunc ()\n ' +
79
79
bold (red ('NameError' )) + ': ' + cyan (global_not_found ) + '\n ' )
80
80
81
81
self .assertMultiLineEqual (str (plain ('' ).join (a )), str (expected ))
@@ -133,19 +133,19 @@ def test_runsource_unicode_autoencode_and_noencode(self):
133
133
# for auto and False, run the same tests
134
134
for encode in ['auto' , False ]:
135
135
i , a = self .interp_errlog ()
136
- i .runsource (u'[1 + 1,\n abc ]' , encode = encode )
136
+ i .runsource (u'[1 + 1,\n abcd ]' , encode = encode )
137
137
self .assertEqual (self .err_lineno (a ), 2 )
138
138
139
139
i , a = self .interp_errlog ()
140
- i .runsource (u'[1 + 1,\n abc ]' , encode = encode )
140
+ i .runsource (u'[1 + 1,\n abcd ]' , encode = encode )
141
141
self .assertEqual (self .err_lineno (a ), 2 )
142
142
143
143
i , a = self .interp_errlog ()
144
- i .runsource (u'#encoding: utf-8\n abc ' , encode = encode )
144
+ i .runsource (u'#encoding: utf-8\n abcd ' , encode = encode )
145
145
self .assertEqual (self .err_lineno (a ), 2 )
146
146
147
147
i , a = self .interp_errlog ()
148
- i .runsource (u'#encoding: utf-8\n abc ' ,
148
+ i .runsource (u'#encoding: utf-8\n abcd ' ,
149
149
filename = 'x.py' , encode = encode )
150
150
self .assertIn ('SyntaxError:' ,
151
151
'' .join ('' .join (remove_ansi (x .__unicode__ ())
@@ -164,46 +164,46 @@ def test_runsource_unicode_encode(self):
164
164
@unittest .skipIf (py3 , "encode only does anything in Python 2" )
165
165
def test_runsource_bytestring_noencode (self ):
166
166
i , a = self .interp_errlog ()
167
- i .runsource (b'[1 + 1,\n abc ]' , encode = False )
167
+ i .runsource (b'[1 + 1,\n abcd ]' , encode = False )
168
168
self .assertEqual (self .err_lineno (a ), 2 )
169
169
170
170
i , a = self .interp_errlog ()
171
- i .runsource (b'[1 + 1,\n abc ]' , filename = 'x.py' , encode = False )
171
+ i .runsource (b'[1 + 1,\n abcd ]' , filename = 'x.py' , encode = False )
172
172
self .assertEqual (self .err_lineno (a ), 2 )
173
173
174
174
i , a = self .interp_errlog ()
175
175
i .runsource (dedent (b'''\
176
176
#encoding: utf-8
177
177
178
178
["%s",
179
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)), encode = False )
179
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)), encode = False )
180
180
self .assertEqual (self .err_lineno (a ), 4 )
181
181
182
182
i , a = self .interp_errlog ()
183
183
i .runsource (dedent (b'''\
184
184
#encoding: utf-8
185
185
186
186
["%s",
187
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)),
187
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)),
188
188
filename = 'x.py' , encode = False )
189
189
self .assertEqual (self .err_lineno (a ), 4 )
190
190
191
191
@unittest .skipIf (py3 , "encode only does anything in Python 2" )
192
192
def test_runsource_bytestring_encode (self ):
193
193
i , a = self .interp_errlog ()
194
- i .runsource (b'[1 + 1,\n abc ]' , encode = True )
194
+ i .runsource (b'[1 + 1,\n abcd ]' , encode = True )
195
195
self .assertEqual (self .err_lineno (a ), 2 )
196
196
197
197
i , a = self .interp_errlog ()
198
198
with self .assertRaises (ValueError ):
199
- i .runsource (b'[1 + 1,\n abc ]' , filename = 'x.py' , encode = True )
199
+ i .runsource (b'[1 + 1,\n abcd ]' , filename = 'x.py' , encode = True )
200
200
201
201
i , a = self .interp_errlog ()
202
202
i .runsource (dedent (b'''\
203
203
#encoding: utf-8
204
204
205
205
[u"%s",
206
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)), encode = True )
206
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)), encode = True )
207
207
self .assertEqual (self .err_lineno (a ), 4 )
208
208
209
209
i , a = self .interp_errlog ()
@@ -212,32 +212,32 @@ def test_runsource_bytestring_encode(self):
212
212
#encoding: utf-8
213
213
214
214
[u"%s",
215
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)),
215
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)),
216
216
filename = 'x.py' ,
217
217
encode = True )
218
218
219
219
@unittest .skipIf (py3 , "encode only does anything in Python 2" )
220
220
def test_runsource_bytestring_autoencode (self ):
221
221
i , a = self .interp_errlog ()
222
- i .runsource (b'[1 + 1,\n abc ]' )
222
+ i .runsource (b'[1 + 1,\n abcd ]' )
223
223
self .assertEqual (self .err_lineno (a ), 2 )
224
224
225
225
i , a = self .interp_errlog ()
226
- i .runsource (b'[1 + 1,\n abc ]' , filename = 'x.py' )
226
+ i .runsource (b'[1 + 1,\n abcd ]' , filename = 'x.py' )
227
227
self .assertEqual (self .err_lineno (a ), 2 )
228
228
229
229
i , a = self .interp_errlog ()
230
230
i .runsource (dedent (b'''\
231
231
#encoding: utf-8
232
232
233
233
[u"%s",
234
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)))
234
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)))
235
235
self .assertEqual (self .err_lineno (a ), 4 )
236
236
237
237
i , a = self .interp_errlog ()
238
238
i .runsource (dedent (b'''\
239
239
#encoding: utf-8
240
240
241
241
[u"%s",
242
- abc ]''' % (u'åß∂ƒ' .encode ('utf8' ),)))
242
+ abcd ]''' % (u'åß∂ƒ' .encode ('utf8' ),)))
243
243
self .assertEqual (self .err_lineno (a ), 4 )
0 commit comments