Commit 22525de7 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

Use more specific asserts in dbm tests. (GH-7786)

This may help to investigate bpo-33901.
parent fc93bd46
...@@ -160,7 +160,7 @@ class WhichDBTestCase(unittest.TestCase): ...@@ -160,7 +160,7 @@ class WhichDBTestCase(unittest.TestCase):
# and test that we can find it # and test that we can find it
self.assertIn(b"1", f) self.assertIn(b"1", f)
# and read it # and read it
self.assertTrue(f[b"1"] == b"1") self.assertEqual(f[b"1"], b"1")
f.close() f.close()
self.assertEqual(name, self.dbm.whichdb(_fname)) self.assertEqual(name, self.dbm.whichdb(_fname))
......
...@@ -74,7 +74,7 @@ class TestGdbm(unittest.TestCase): ...@@ -74,7 +74,7 @@ class TestGdbm(unittest.TestCase):
self.g['x'] = 'x' * 10000 self.g['x'] = 'x' * 10000
size1 = os.path.getsize(filename) size1 = os.path.getsize(filename)
self.assertTrue(size0 < size1) self.assertGreater(size1, size0)
del self.g['x'] del self.g['x']
# 'size' is supposed to be the same even after deleting an entry. # 'size' is supposed to be the same even after deleting an entry.
...@@ -82,7 +82,8 @@ class TestGdbm(unittest.TestCase): ...@@ -82,7 +82,8 @@ class TestGdbm(unittest.TestCase):
self.g.reorganize() self.g.reorganize()
size2 = os.path.getsize(filename) size2 = os.path.getsize(filename)
self.assertTrue(size1 > size2 >= size0) self.assertLess(size2, size1)
self.assertGreaterEqual(size2, size0)
def test_context_manager(self): def test_context_manager(self):
with gdbm.open(filename, 'c') as db: with gdbm.open(filename, 'c') as db:
......
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