summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-08-02 12:17:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-08-02 12:17:49 (GMT)
commit0dcd80a6c06d0fa1b1250e33e868b196d6d80efc (patch)
tree1a50131cf0cd83f1899ce13aed21ed8d045a767e /Lib/test/test_io.py
parentce17f764757306cdcdf1555c67dd0eed8e6bca8a (diff)
downloadcpython-0dcd80a6c06d0fa1b1250e33e868b196d6d80efc.zip
cpython-0dcd80a6c06d0fa1b1250e33e868b196d6d80efc.tar.gz
cpython-0dcd80a6c06d0fa1b1250e33e868b196d6d80efc.tar.bz2
Issue #20557: Use specific asserts in io tests.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 416c547..f654406 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -453,7 +453,7 @@ class IOTest(unittest.TestCase):
with self.open(support.TESTFN, "ab") as f:
self.assertEqual(f.tell(), 3)
with self.open(support.TESTFN, "a") as f:
- self.assertTrue(f.tell() > 0)
+ self.assertGreater(f.tell(), 0)
def test_destructor(self):
record = []
@@ -573,7 +573,7 @@ class IOTest(unittest.TestCase):
wr = weakref.ref(f)
del f
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
with self.open(support.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"abcxxx")
@@ -717,7 +717,7 @@ class CIOTest(IOTest):
del MyIO
del obj
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
class PyIOTest(IOTest):
pass
@@ -1164,7 +1164,7 @@ class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
wr = weakref.ref(f)
del f
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
def test_args_error(self):
# Issue #17275
@@ -1467,7 +1467,7 @@ class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
wr = weakref.ref(f)
del f
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
with self.open(support.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"123xxx")
@@ -2199,7 +2199,7 @@ class TextIOWrapperTest(unittest.TestCase):
t = self.TextIOWrapper(b, encoding="utf-8")
self.assertEqual(t.encoding, "utf-8")
t = self.TextIOWrapper(b)
- self.assertTrue(t.encoding is not None)
+ self.assertIsNotNone(t.encoding)
codecs.lookup(t.encoding)
def test_encoding_errors_reading(self):
@@ -2958,7 +2958,7 @@ class CTextIOWrapperTest(TextIOWrapperTest):
wr = weakref.ref(t)
del t
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
with self.open(support.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"456def")
@@ -3106,7 +3106,7 @@ class MiscIOTest(unittest.TestCase):
def test___all__(self):
for name in self.io.__all__:
obj = getattr(self.io, name, None)
- self.assertTrue(obj is not None, name)
+ self.assertIsNotNone(obj, name)
if name == "open":
continue
elif "error" in name.lower() or name == "UnsupportedOperation":
@@ -3196,7 +3196,7 @@ class MiscIOTest(unittest.TestCase):
wr = weakref.ref(c)
del c, b
support.gc_collect()
- self.assertTrue(wr() is None, wr)
+ self.assertIsNone(wr(), wr)
def test_abcs(self):
# Test the visible base classes are ABCs.
@@ -3348,7 +3348,7 @@ class MiscIOTest(unittest.TestCase):
received += iter(rf.read, None)
sent, received = b''.join(sent), b''.join(received)
- self.assertTrue(sent == received)
+ self.assertEqual(sent, received)
self.assertTrue(wf.closed)
self.assertTrue(rf.closed)