mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
There is no TestError, use TestFailed appropriately
This commit is contained in:
parent
8392f36579
commit
b1295da59e
3 changed files with 10 additions and 10 deletions
|
|
@ -785,7 +785,7 @@ def metaclass():
|
||||||
c = C()
|
c = C()
|
||||||
try: c()
|
try: c()
|
||||||
except TypeError: pass
|
except TypeError: pass
|
||||||
else: raise TestError, "calling object w/o call method should raise TypeError"
|
else: raise TestFailed, "calling object w/o call method should raise TypeError"
|
||||||
|
|
||||||
def pymods():
|
def pymods():
|
||||||
if verbose: print "Testing Python subclass of module..."
|
if verbose: print "Testing Python subclass of module..."
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from array import array
|
from array import array
|
||||||
|
|
||||||
from test_support import verify, TESTFN
|
from test_support import verify, TESTFN, TestFailed
|
||||||
from UserList import UserList
|
from UserList import UserList
|
||||||
|
|
||||||
# verify writelines with instance sequence
|
# verify writelines with instance sequence
|
||||||
|
|
@ -70,23 +70,23 @@ else:
|
||||||
|
|
||||||
f = open(TESTFN)
|
f = open(TESTFN)
|
||||||
if f.name != TESTFN:
|
if f.name != TESTFN:
|
||||||
raise TestError, 'file.name should be "%s"' % TESTFN
|
raise TestFailed, 'file.name should be "%s"' % TESTFN
|
||||||
if f.isatty():
|
if f.isatty():
|
||||||
raise TestError, 'file.isatty() should be false'
|
raise TestFailed, 'file.isatty() should be false'
|
||||||
|
|
||||||
if f.closed:
|
if f.closed:
|
||||||
raise TestError, 'file.closed should be false'
|
raise TestFailed, 'file.closed should be false'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f.readinto("")
|
f.readinto("")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise TestError, 'file.readinto("") should raise a TypeError'
|
raise TestFailed, 'file.readinto("") should raise a TypeError'
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
if not f.closed:
|
if not f.closed:
|
||||||
raise TestError, 'file.closed should be true'
|
raise TestFailed, 'file.closed should be true'
|
||||||
|
|
||||||
for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ]:
|
for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ]:
|
||||||
method = getattr(f, methodname)
|
method = getattr(f, methodname)
|
||||||
|
|
@ -95,13 +95,13 @@ for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline',
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise TestError, 'file.%s() on a closed file should raise a ValueError' % methodname
|
raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f.writelines([])
|
f.writelines([])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise TestError, 'file.writelines([]) on a closed file should raise a ValueError'
|
raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError'
|
||||||
|
|
||||||
os.unlink(TESTFN)
|
os.unlink(TESTFN)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import mpz
|
import mpz
|
||||||
from test_support import vereq
|
from test_support import vereq, TestFailed
|
||||||
|
|
||||||
def check_conversion(num):
|
def check_conversion(num):
|
||||||
mpz_num = mpz.mpz(num)
|
mpz_num = mpz.mpz(num)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue