diff options
author | Guido van Rossum <guido@python.org> | 2007-04-12 05:44:49 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-04-12 05:44:49 +0000 |
commit | d410395ea7febe1d9daf3cd6a57dad36c31d3fb7 (patch) | |
tree | cc003f6694928e7c32d8b809ba518a01167d6d47 /Lib/test/test_io.py | |
parent | aa43ed95cd14366e95a724cb94eb9369195fb27b (diff) | |
download | cpython-git-d410395ea7febe1d9daf3cd6a57dad36c31d3fb7.tar.gz |
Make sure that writing an array instance returns the number of bytes,
not the number of array elements.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 688f6dc200..737dfab36b 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2,6 +2,7 @@ import sys import time +import array import unittest from itertools import chain from test import test_support @@ -235,6 +236,16 @@ class IOTest(unittest.TestCase): self.assertEqual(f.read(), b"xxx") f.close() + def test_array_writes(self): + a = array.array('i', range(10)) + n = len(buffer(a)) + f = io.open(test_support.TESTFN, "wb", 0) + self.assertEqual(f.write(a), n) + f.close() + f = io.open(test_support.TESTFN, "wb") + self.assertEqual(f.write(a), n) + f.close() + class MemorySeekTestMixin: |