Terry J. Reedy added the comment:
I agree with the revised title. Test_context_manager() should also test that db
is actually closed after the with statement. I presume you can use
self.assertRaises and try to do something with db that will fail if it is
properly closed.
with self.assertRaises(<NotOpenError>):
db['a'] = 'a' # or whatever
I haven't looked at the C code.
----------
nosy: +terry.reedy
stage: needs patch -> patch review
title: dbm is not a context manager -> dbm.open should be a context manager
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19282>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com