mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
Issue #12451: Open files in binary mode in some tests when the text file is not
needed. Remove also an unused variable (blank) in test_threading.
This commit is contained in:
parent
eaf399e335
commit
a6d2c769fb
5 changed files with 16 additions and 18 deletions
|
@ -689,12 +689,11 @@ class MakedirTests(unittest.TestCase):
|
|||
|
||||
class DevNullTests(unittest.TestCase):
|
||||
def test_devnull(self):
|
||||
f = open(os.devnull, 'w')
|
||||
f.write('hello')
|
||||
f.close()
|
||||
f = open(os.devnull, 'r')
|
||||
self.assertEqual(f.read(), '')
|
||||
f.close()
|
||||
with open(os.devnull, 'wb') as f:
|
||||
f.write(b'hello')
|
||||
f.close()
|
||||
with open(os.devnull, 'rb') as f:
|
||||
self.assertEqual(f.read(), b'')
|
||||
|
||||
class URandomTests(unittest.TestCase):
|
||||
def test_urandom(self):
|
||||
|
@ -1044,7 +1043,7 @@ if sys.platform != 'win32':
|
|||
|
||||
def test_open(self):
|
||||
for fn in self.unicodefn:
|
||||
f = open(os.path.join(self.dir, fn))
|
||||
f = open(os.path.join(self.dir, fn), 'rb')
|
||||
f.close()
|
||||
|
||||
def test_stat(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue