Skip to content

Commit cf703fe

Browse files
committed
patch 7.4.2350
Problem: Test 86 and 87 fail with some version of Python. Solution: Unify "can't" and "cannot". Unify quotes.
1 parent 2321ca2 commit cf703fe

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

src/testdir/test86.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ def ee(expr, g=globals(), l=locals()):
239239
'TypeError:("\'FailingNumber\' object is not iterable",)')
240240
if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
241241
msg = msg.replace('(\'', '("').replace('\',)', '",)')
242+
# Some Python versions say can't, others cannot.
243+
if msg.find('can\'t') > -1:
244+
msg = msg.replace('can\'t', 'cannot')
245+
# Some Python versions use single quote, some double quote
246+
if msg.find('"cannot ') > -1:
247+
msg = msg.replace('"cannot ', '\'cannot ')
248+
if msg.find(' attributes"') > -1:
249+
msg = msg.replace(' attributes"', ' attributes\'')
242250
if expr == 'fd(self=[])':
243251
# HACK: PyMapping_Check changed meaning
244252
msg = msg.replace('AttributeError:(\'keys\',)',

src/testdir/test86.ok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ testdir
628628
test86.in
629629
> Output
630630
>> OutputSetattr
631-
del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",)
631+
del sys.stdout.softspace:AttributeError:('cannot delete OutputObject attributes',)
632632
>>> Testing NumberToLong using sys.stdout.softspace = %s
633633
sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
634634
sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)

src/testdir/test87.in

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,18 @@ def ee(expr, g=globals(), l=locals()):
238238
else:
239239
cb.append(expr + ':' + repr((e.__class__, e)))
240240
elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte':
241-
msg = cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null'))))
241+
cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null'))))
242242
else:
243-
cb.append(expr + ':' + repr((e.__class__, e)))
243+
msg = repr((e.__class__, e))
244+
# Some Python versions say can't, others cannot.
245+
if msg.find('can\'t') > -1:
246+
msg = msg.replace('can\'t', 'cannot')
247+
# Some Python versions use single quote, some double quote
248+
if msg.find('"cannot ') > -1:
249+
msg = msg.replace('"cannot ', '\'cannot ')
250+
if msg.find(' attributes"') > -1:
251+
msg = msg.replace(' attributes"', ' attributes\'')
252+
cb.append(expr + ':' + msg)
244253
else:
245254
cb.append(expr + ':NOT FAILED')
246255
except Exception as e:

src/testdir/test87.ok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ b'testdir'
628628
test87.in
629629
> Output
630630
>> OutputSetattr
631-
del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",))
631+
del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError('cannot delete OutputObject attributes',))
632632
>>> Testing NumberToLong using sys.stdout.softspace = %s
633633
sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
634634
sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2350,
766768
/**/
767769
2349,
768770
/**/

0 commit comments

Comments
 (0)