[pypy-svn] r11781 - pypy/dist/lib-python/modified-2.3.4/test
arigo at codespeak.net
arigo at codespeak.net
Mon May 2 15:52:14 CEST 2005
Author: arigo
Date: Mon May 2 15:52:14 2005
New Revision: 11781
Added:
pypy/dist/lib-python/modified-2.3.4/test/test_file.py
- copied, changed from r11778, pypy/dist/lib-python/2.3.4/test/test_file.py
Log:
Fixed test_file.py.
Copied: pypy/dist/lib-python/modified-2.3.4/test/test_file.py (from r11778, pypy/dist/lib-python/2.3.4/test/test_file.py)
==============================================================================
--- pypy/dist/lib-python/2.3.4/test/test_file.py (original)
+++ pypy/dist/lib-python/modified-2.3.4/test/test_file.py Mon May 2 15:52:14 2005
@@ -19,7 +19,7 @@
for attr in 'name', 'mode', 'closed':
try:
setattr(f, attr, 'oops')
- except TypeError:
+ except (TypeError, AttributeError):
pass
else:
raise TestFailed('expected TypeError setting file attr %r' % attr)
@@ -126,26 +126,21 @@
if d != s:
raise TestFailed, 'readback failure using buffer size %d'
-methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readinto',
- 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write',
- 'xreadlines', '__iter__']
+a = array('c', 'x'*10)
+methods = {'fileno': (), 'flush': (), 'isatty': (), 'next': (),
+ 'read': (), 'readinto': (a,), 'readline': (), 'readlines': (),
+ 'seek': (0,), 'tell': (), 'truncate': (), 'write': ('',),
+ 'writelines': ([],), 'xreadlines': (), '__iter__': () }
if sys.platform.startswith('atheos'):
- methods.remove('truncate')
+ del methods['truncate']
-for methodname in methods:
+for methodname, args in methods.items():
method = getattr(f, methodname)
try:
- method()
+ method(*args)
except ValueError:
pass
else:
raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname
-try:
- f.writelines([])
-except ValueError:
- pass
-else:
- raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError'
-
os.unlink(TESTFN)
More information about the Pypy-commit
mailing list