We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
_locked
_file
1 parent 2131714 commit 6814da0Copy full SHA for 6814da0
Lib/test/test_mailbox.py
@@ -1127,6 +1127,16 @@ def test_ownership_after_flush(self):
1127
self.assertEqual(st.st_gid, other_gid)
1128
self.assertEqual(st.st_mode, mode)
1129
1130
+ def test_context_manager_locks_and_closes(self):
1131
+ # Context manager locks/unlocks and closes.
1132
+ # (This test uses an implementation detail to get the state.)
1133
+ self.assertFalse(self._box._locked)
1134
+ with self._box as context_object:
1135
+ self.assertIs(self._box, context_object)
1136
+ self.assertTrue(self._box._locked)
1137
+ self.assertFalse(self._box._file.closed)
1138
1139
+ self.assertTrue(self._box._file.closed)
1140
1141
class _TestMboxMMDF(_TestSingleFile):
1142
0 commit comments