summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-11-22 00:41:45 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-11-22 00:41:45 (GMT)
commit44309e6b3768d6d559491ddf6ca56bfad2adb9b5 (patch)
tree5d71526f8d1b06a39c67191bf55e85e68c205c95 /Lib/test
parent656aa28cd50d00171d46df30eaeecd45eb0ae32c (diff)
downloadcpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.zip
cpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.tar.gz
cpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.tar.bz2
make FileIO.mode always include 'b'
#4386 Reviewed by Amaury
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_fileio.py4
-rw-r--r--Lib/test/test_gzip.py2
-rw-r--r--Lib/test/test_io.py14
-rw-r--r--Lib/test/test_socket.py4
4 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index a11d3ba..80de93d 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -49,7 +49,7 @@ class AutoFileTests(unittest.TestCase):
# verify expected attributes exist
f = self.f
- self.assertEquals(f.mode, "w")
+ self.assertEquals(f.mode, "wb")
self.assertEquals(f.closed, False)
# verify the attributes are readonly
@@ -159,7 +159,7 @@ class OtherFileTests(unittest.TestCase):
def testModeStrings(self):
# check invalid mode strings
- for mode in ("", "aU", "wU+", "rb", "rt"):
+ for mode in ("", "aU", "wU+", "rw", "rt"):
try:
f = _fileio._FileIO(TESTFN, mode)
except ValueError:
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 3493b8d..d28c024 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -150,7 +150,7 @@ class TestGzip(unittest.TestCase):
def test_mode(self):
self.test_write()
f = gzip.GzipFile(self.filename, 'r')
- self.assertTrue(f.myfileobj.mode.startswith('r'))
+ self.assertEqual(f.myfileobj.mode, 'rb')
f.close()
def test_1647484(self):
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 79cfd8a..58203ed 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1266,7 +1266,7 @@ class MiscIOTest(unittest.TestCase):
def test_attributes(self):
f = io.open(support.TESTFN, "wb", buffering=0)
- self.assertEquals(f.mode, "w")
+ self.assertEquals(f.mode, "wb")
f.close()
f = io.open(support.TESTFN, "U")
@@ -1274,18 +1274,18 @@ class MiscIOTest(unittest.TestCase):
self.assertEquals(f.buffer.name, support.TESTFN)
self.assertEquals(f.buffer.raw.name, support.TESTFN)
self.assertEquals(f.mode, "U")
- self.assertEquals(f.buffer.mode, "r")
- self.assertEquals(f.buffer.raw.mode, "r")
+ self.assertEquals(f.buffer.mode, "rb")
+ self.assertEquals(f.buffer.raw.mode, "rb")
f.close()
f = io.open(support.TESTFN, "w+")
self.assertEquals(f.mode, "w+")
- self.assertEquals(f.buffer.mode, "r+") # Does it really matter?
- self.assertEquals(f.buffer.raw.mode, "r+")
+ self.assertEquals(f.buffer.mode, "rb+") # Does it really matter?
+ self.assertEquals(f.buffer.raw.mode, "rb+")
g = io.open(f.fileno(), "wb", closefd=False)
- self.assertEquals(g.mode, "w")
- self.assertEquals(g.raw.mode, "w")
+ self.assertEquals(g.mode, "wb")
+ self.assertEquals(g.raw.mode, "wb")
self.assertEquals(g.name, f.fileno())
self.assertEquals(g.raw.name, f.fileno())
f.close()
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index b2323fe..51f41a9 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -849,11 +849,11 @@ class FileObjectClassTestCase(SocketConnectedTest):
self.assert_(not self.cli_file.closed)
def testAttributes(self):
- self.assertEqual(self.serv_file.mode, 'r')
+ self.assertEqual(self.serv_file.mode, 'rb')
self.assertEqual(self.serv_file.name, self.cli_conn.fileno())
def _testAttributes(self):
- self.assertEqual(self.cli_file.mode, 'w')
+ self.assertEqual(self.cli_file.mode, 'wb')
self.assertEqual(self.cli_file.name, self.serv_conn.fileno())
class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase):