def test_printer(self): watch.restore() s = io.StringIO() with redirect_stdout(s): watch.config(file=sys.stdout) a = [1, 2, 3] watch(a) a[0] = 2 unwatch() self.assertNotEqual(s.getvalue(), "")
def test_stack_limit(self): watch.restore() watch.config(stack_limit=1) s = io.StringIO() with redirect_stdout(s): watch.config(file=sys.stdout) a = [1, 2, 3] watch(a) a[0] = 2 unwatch() self.assertEqual(s.getvalue().count("> "), 1)
def setUp(self): unwatch() watch.restore()
def tearDown(self): watch.restore() return super().tearDown()