summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-04-13 18:42:35 (GMT)
committerGuido van Rossum <guido@python.org>2007-04-13 18:42:35 (GMT)
commit13633bb8c5bd2dbd2b9955539495ac6fb632776c (patch)
treeec0bc79cb915802f9e32b371b6b2cffdbfd4e52e /Lib/test
parent913dd0be52f28fbc5036d95722b80222880706fd (diff)
downloadcpython-13633bb8c5bd2dbd2b9955539495ac6fb632776c.zip
cpython-13633bb8c5bd2dbd2b9955539495ac6fb632776c.tar.gz
cpython-13633bb8c5bd2dbd2b9955539495ac6fb632776c.tar.bz2
Support name and mode attributes on all file types.
Don't read more than one line when reading text from a tty device. Add peek() and read1() methods. Return str instead of unicode when return ASCII characters in text mode.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bytes.py9
-rw-r--r--Lib/test/test_fileio.py1
2 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 999346f..e0bb21e 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -163,14 +163,7 @@ class BytesTest(unittest.TestCase):
f.write(b)
with open(tfn, "rb") as f:
self.assertEqual(f.read(), sample)
- # Test writing in text mode
- with open(tfn, "w") as f:
- f.write(b)
- with open(tfn, "r") as f:
- self.assertEqual(f.read(), sample)
- # Can't use readinto in text mode
- with open(tfn, "r") as f:
- self.assertRaises(TypeError, f.readinto, b)
+ # Text mode is ambiguous; don't test
finally:
try:
os.remove(tfn)
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 6a78154..bb98190 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -51,6 +51,7 @@ class AutoFileTests(unittest.TestCase):
self.assertEquals(f.mode, "w")
self.assertEquals(f.closed, False)
+ self.assertEquals(f.name, TESTFN)
# verify the attributes are readonly
for attr in 'mode', 'closed':