Kaydet (Commit) 7dcb8448 authored tarafından Guido van Rossum's avatar Guido van Rossum

More str/bytes strictness.

üst 7d5baac8
...@@ -143,7 +143,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -143,7 +143,7 @@ class PosixPathTest(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(posixpath.getsize(test_support.TESTFN), 3) self.assertEqual(posixpath.getsize(test_support.TESTFN), 3)
finally: finally:
...@@ -153,10 +153,10 @@ class PosixPathTest(unittest.TestCase): ...@@ -153,10 +153,10 @@ class PosixPathTest(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()
...@@ -175,7 +175,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -175,7 +175,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False)
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(posixpath.islink(test_support.TESTFN + "1"), False) self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False)
if hasattr(os, "symlink"): if hasattr(os, "symlink"):
...@@ -195,7 +195,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -195,7 +195,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.exists(test_support.TESTFN), False) self.assertIs(posixpath.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(posixpath.exists(test_support.TESTFN), True) self.assertIs(posixpath.exists(test_support.TESTFN), True)
self.assertIs(posixpath.lexists(test_support.TESTFN), True) self.assertIs(posixpath.lexists(test_support.TESTFN), True)
...@@ -209,7 +209,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -209,7 +209,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.isdir(test_support.TESTFN), False) self.assertIs(posixpath.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(posixpath.isdir(test_support.TESTFN), False) self.assertIs(posixpath.isdir(test_support.TESTFN), False)
os.remove(test_support.TESTFN) os.remove(test_support.TESTFN)
...@@ -226,7 +226,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -226,7 +226,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.isfile(test_support.TESTFN), False) self.assertIs(posixpath.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(posixpath.isfile(test_support.TESTFN), True) self.assertIs(posixpath.isfile(test_support.TESTFN), True)
os.remove(test_support.TESTFN) os.remove(test_support.TESTFN)
...@@ -242,7 +242,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -242,7 +242,7 @@ class PosixPathTest(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(
posixpath.samefile( posixpath.samefile(
...@@ -267,7 +267,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -267,7 +267,7 @@ class PosixPathTest(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(
posixpath.samefile( posixpath.samefile(
...@@ -285,7 +285,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -285,7 +285,7 @@ class PosixPathTest(unittest.TestCase):
def test_samestat(self): def test_samestat(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(
posixpath.samestat( posixpath.samestat(
...@@ -308,7 +308,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -308,7 +308,7 @@ class PosixPathTest(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(
posixpath.samestat( posixpath.samestat(
......
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