def test_watch_removed(self):
path = '/test'
events = [{'e': i} for i in range(3)]
def handler(event):
self.assertFalse(watcher_obj._idle[path])
watcher_obj._resources.remove(path)
m_handler = mock.Mock()
m_handler.side_effect = handler
watcher_obj = self._test_watch_create_watcher(path, m_handler)
self._test_watch_mock_events(watcher_obj, events)
watcher_obj._watch(path)
m_handler.assert_called_once_with(events[0])
self.assertNotIn(path, watcher_obj._idle)
self.assertNotIn(path, watcher_obj._watching)
评论列表
文章目录