summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dbm_gnu.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_dbm_gnu.py')
-rw-r--r--Lib/test/test_dbm_gnu.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py
index 4eaa0f4..73602ca 100644
--- a/Lib/test/test_dbm_gnu.py
+++ b/Lib/test/test_dbm_gnu.py
@@ -118,6 +118,20 @@ class TestGdbm(unittest.TestCase):
self.assertEqual(str(cm.exception),
"GDBM object has already been closed")
+ def test_bool_empty(self):
+ with gdbm.open(filename, 'c') as db:
+ self.assertFalse(bool(db))
+
+ def test_bool_not_empty(self):
+ with gdbm.open(filename, 'c') as db:
+ db['a'] = 'b'
+ self.assertTrue(bool(db))
+
+ def test_bool_on_closed_db_raises(self):
+ with gdbm.open(filename, 'c') as db:
+ db['a'] = 'b'
+ self.assertRaises(gdbm.error, bool, db)
+
def test_bytes(self):
with gdbm.open(filename, 'c') as db:
db[b'bytes key \xbd'] = b'bytes value \xbd'