Skip to content

Commit

Permalink
patch 7.4.2350
Browse files Browse the repository at this point in the history
Problem:    Test 86 and 87 fail with some version of Python.
Solution:   Unify "can't" and "cannot".  Unify quotes.
  • Loading branch information
brammool committed Sep 9, 2016
1 parent 2321ca2 commit cf703fe
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/testdir/test86.in
Expand Up @@ -239,6 +239,14 @@ def ee(expr, g=globals(), l=locals()):
'TypeError:("\'FailingNumber\' object is not iterable",)') 'TypeError:("\'FailingNumber\' object is not iterable",)')
if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1: if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
msg = msg.replace('(\'', '("').replace('\',)', '",)') msg = msg.replace('(\'', '("').replace('\',)', '",)')
# Some Python versions say can't, others cannot.
if msg.find('can\'t') > -1:
msg = msg.replace('can\'t', 'cannot')
# Some Python versions use single quote, some double quote
if msg.find('"cannot ') > -1:
msg = msg.replace('"cannot ', '\'cannot ')
if msg.find(' attributes"') > -1:
msg = msg.replace(' attributes"', ' attributes\'')
if expr == 'fd(self=[])': if expr == 'fd(self=[])':
# HACK: PyMapping_Check changed meaning # HACK: PyMapping_Check changed meaning
msg = msg.replace('AttributeError:(\'keys\',)', msg = msg.replace('AttributeError:(\'keys\',)',
Expand Down
2 changes: 1 addition & 1 deletion src/testdir/test86.ok
Expand Up @@ -628,7 +628,7 @@ testdir
test86.in test86.in
> Output > Output
>> OutputSetattr >> OutputSetattr
del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",) del sys.stdout.softspace:AttributeError:('cannot delete OutputObject attributes',)
>>> Testing NumberToLong using sys.stdout.softspace = %s >>> Testing NumberToLong using sys.stdout.softspace = %s
sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',) sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',) sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
Expand Down
13 changes: 11 additions & 2 deletions src/testdir/test87.in
Expand Up @@ -238,9 +238,18 @@ def ee(expr, g=globals(), l=locals()):
else: else:
cb.append(expr + ':' + repr((e.__class__, e))) cb.append(expr + ':' + repr((e.__class__, e)))
elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte':
msg = cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null')))) cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null'))))
else: else:
cb.append(expr + ':' + repr((e.__class__, e))) msg = repr((e.__class__, e))
# Some Python versions say can't, others cannot.
if msg.find('can\'t') > -1:
msg = msg.replace('can\'t', 'cannot')
# Some Python versions use single quote, some double quote
if msg.find('"cannot ') > -1:
msg = msg.replace('"cannot ', '\'cannot ')
if msg.find(' attributes"') > -1:
msg = msg.replace(' attributes"', ' attributes\'')
cb.append(expr + ':' + msg)
else: else:
cb.append(expr + ':NOT FAILED') cb.append(expr + ':NOT FAILED')
except Exception as e: except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion src/testdir/test87.ok
Expand Up @@ -628,7 +628,7 @@ b'testdir'
test87.in test87.in
> Output > Output
>> OutputSetattr >> OutputSetattr
del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",)) del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError('cannot delete OutputObject attributes',))
>>> Testing NumberToLong using sys.stdout.softspace = %s >>> Testing NumberToLong using sys.stdout.softspace = %s
sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',)) sys.stdout.softspace = []:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got list',))
sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) sys.stdout.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -763,6 +763,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2350,
/**/ /**/
2349, 2349,
/**/ /**/
Expand Down

0 comments on commit cf703fe

Please sign in to comment.