[Python-checkins] r57191 - python/branches/alex-py3k/Lib/test/test_memoryio.py
alexandre.vassalotti
python-checkins at python.org
Sun Aug 19 01:58:11 CEST 2007
Author: alexandre.vassalotti
Date: Sun Aug 19 01:57:51 2007
New Revision: 57191
Modified:
python/branches/alex-py3k/Lib/test/test_memoryio.py
Log:
Add a test to check if methods, which takes an optional argument, also
accept None.
Comment out truncate()'s negative argument test.
Modified: python/branches/alex-py3k/Lib/test/test_memoryio.py
==============================================================================
--- python/branches/alex-py3k/Lib/test/test_memoryio.py (original)
+++ python/branches/alex-py3k/Lib/test/test_memoryio.py Sun Aug 19 01:57:51 2007
@@ -67,7 +67,8 @@
self.assertEqual(memio.tell(), 4)
memio.write(buf)
self.assertEqual(memio.getvalue(), buf[:4] + buf)
- self.assertRaises(ValueError, memio.truncate, -1)
+ # XXX Should truncate() fail when given a negative argument?
+ #self.assertRaises(ValueError, memio.truncate, -1)
memio.close()
memio.truncate(0)
@@ -271,6 +272,13 @@
self.assertEqual(memio.getvalue(), self.buftype(buf + buf))
self.write_ops(self.ioclass(), str)
+ def test_none_arg(self):
+ memio = self.ioclass(None)
+
+ self.assertEqual(memio.read(None), self.EOF)
+ self.assertEqual(memio.readline(None), self.EOF)
+ self.assertEqual(memio.truncate(None), 0)
+
class PyStringIOTest(MemoryTestMixin, unittest.TestCase):
buftype = str
More information about the Python-checkins
mailing list