def test_on_change(self): x = Autoreloader(Mock(), modules=[__name__]) mm = x._maybe_modified = Mock(0) mm.return_value = True x._reload = Mock() x._module_name = Mock() x.on_change([__name__]) self.assertTrue(x._reload.called) mm.return_value = False x.on_change([__name__])
def test_module_name(self): x = Autoreloader(Mock(), modules=[__name__]) self.assertEqual(x._module_name("foo/bar/baz.py"), "baz")
def test_module_name(self): x = Autoreloader(Mock(), modules=[__name__]) self.assertEqual(x._module_name('foo/bar/baz.py'), 'baz')