Commit 199fc75d authored by Guido van Rossum's avatar Guido van Rossum

str/bytes strictness.

parent b644fb43
...@@ -29,7 +29,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -29,7 +29,7 @@ class AllCommonTest(unittest.TestCase):
def test_getsize(self): def test_getsize(self):
f = open(test_support.TESTFN, "wb") f = open(test_support.TESTFN, "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
self.assertEqual(genericpath.getsize(test_support.TESTFN), 3) self.assertEqual(genericpath.getsize(test_support.TESTFN), 3)
finally: finally:
...@@ -40,10 +40,10 @@ class AllCommonTest(unittest.TestCase): ...@@ -40,10 +40,10 @@ class AllCommonTest(unittest.TestCase):
def test_time(self): def test_time(self):
f = open(test_support.TESTFN, "wb") f = open(test_support.TESTFN, "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
f = open(test_support.TESTFN, "ab") f = open(test_support.TESTFN, "ab")
f.write("bar") f.write(b"bar")
f.close() f.close()
f = open(test_support.TESTFN, "rb") f = open(test_support.TESTFN, "rb")
d = f.read() d = f.read()
...@@ -63,7 +63,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -63,7 +63,7 @@ class AllCommonTest(unittest.TestCase):
self.assertIs(genericpath.exists(test_support.TESTFN), False) self.assertIs(genericpath.exists(test_support.TESTFN), False)
f = open(test_support.TESTFN, "wb") f = open(test_support.TESTFN, "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
self.assertIs(genericpath.exists(test_support.TESTFN), True) self.assertIs(genericpath.exists(test_support.TESTFN), True)
finally: finally:
...@@ -80,7 +80,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -80,7 +80,7 @@ class AllCommonTest(unittest.TestCase):
self.assertIs(genericpath.isdir(test_support.TESTFN), False) self.assertIs(genericpath.isdir(test_support.TESTFN), False)
f = open(test_support.TESTFN, "wb") f = open(test_support.TESTFN, "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
self.assertIs(genericpath.isdir(test_support.TESTFN), False) self.assertIs(genericpath.isdir(test_support.TESTFN), False)
os.remove(test_support.TESTFN) os.remove(test_support.TESTFN)
...@@ -105,7 +105,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -105,7 +105,7 @@ class AllCommonTest(unittest.TestCase):
self.assertIs(genericpath.isfile(test_support.TESTFN), False) self.assertIs(genericpath.isfile(test_support.TESTFN), False)
f = open(test_support.TESTFN, "wb") f = open(test_support.TESTFN, "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
self.assertIs(genericpath.isfile(test_support.TESTFN), True) self.assertIs(genericpath.isfile(test_support.TESTFN), True)
os.remove(test_support.TESTFN) os.remove(test_support.TESTFN)
...@@ -129,7 +129,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -129,7 +129,7 @@ class AllCommonTest(unittest.TestCase):
def test_samefile(self): def test_samefile(self):
f = open(test_support.TESTFN + "1", "wb") f = open(test_support.TESTFN + "1", "wb")
try: try:
f.write("foo") f.write(b"foo")
f.close() f.close()
self.assertIs( self.assertIs(
genericpath.samefile( genericpath.samefile(
...@@ -154,7 +154,7 @@ class AllCommonTest(unittest.TestCase): ...@@ -154,7 +154,7 @@ class AllCommonTest(unittest.TestCase):
) )
os.remove(test_support.TESTFN + "2") os.remove(test_support.TESTFN + "2")
f = open(test_support.TESTFN + "2", "wb") f = open(test_support.TESTFN + "2", "wb")
f.write("bar") f.write(b"bar")
f.close() f.close()
self.assertIs( self.assertIs(
genericpath.samefile( genericpath.samefile(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment