Lines Matching refs:instance
33 instance, filename = self._make_one()
34 self.assertFalse(instance._locked)
35 self.assertEqual(instance._filename, filename)
36 self.assertEqual(instance._mode, 'r+')
37 self.assertEqual(instance._fallback_mode, 'r')
38 self.assertIsNone(instance._fh)
39 self.assertIsNone(instance._lock_fd)
42 instance, _ = self._make_one()
43 self.assertFalse(instance.is_locked())
44 instance._locked = True
45 self.assertTrue(instance.is_locked())
48 instance, _ = self._make_one()
49 self.assertIsNone(instance.file_handle())
51 instance._fh = fh
52 self.assertEqual(instance.file_handle(), fh)
55 instance, filename = self._make_one()
56 self.assertEqual(instance.filename(), filename)
59 instance, _ = self._make_one()
60 instance.open_and_lock(1, 1)
63 instance, _ = self._make_one()
64 instance.unlock_and_close()
74 instance, _ = self._make_one()
75 instance.open_and_lock(1, 1)
77 self.assertTrue(instance.is_locked())
78 self.assertIsNotNone(instance.file_handle())
80 instance.open_and_lock(1, 1)
87 instance, _ = self._make_one()
89 instance.open_and_lock(1, 1)
91 self.assertIsNone(instance.file_handle())
92 self.assertTrue(instance.is_locked())
96 instance, _ = self._make_one()
99 instance.open_and_lock(1, 1)
101 self.assertEqual(instance.file_handle(), fh_mock)
102 self.assertFalse(instance.is_locked())
106 instance, _ = self._make_one()
111 instance.open_and_lock(1, 1)
117 instance, _ = self._make_one()
124 instance.open_and_lock(1, 1)
125 self.assertFalse(instance.is_locked())
132 instance, _ = self._make_one()
142 instance.open_and_lock(1, 1)
143 self.assertFalse(instance.is_locked())
145 self.assertEqual(instance.file_handle(), fh_mock)
151 instance, _ = self._make_one()
160 instance.open_and_lock(10, 1)
162 self.assertTrue(instance.is_locked())
167 instance, _ = self._make_one()
168 instance._locked = True
169 lock_fd_mock = instance._lock_fd = mock.Mock()
170 instance._fh = mock.Mock()
172 instance.unlock_and_close()
174 self.assertFalse(instance.is_locked())
177 self.assertTrue(instance._fh.close.called)
222 instance, opener = self._make_one()
224 self.assertEqual(instance.filename(), 'some file')
227 instance, opener = self._make_one()
228 self.assertEqual(instance.file_handle(), opener.file_handle())
232 instance, opener = self._make_one()
233 self.assertEqual(instance.is_locked(), opener.is_locked())
237 instance, opener = self._make_one()
238 instance.open_and_lock()
242 instance, opener = self._make_one()
243 instance.unlock_and_close()