Example #1
0
 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(), "")
Example #2
0
 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)
Example #3
0
 def setUp(self):
     unwatch()
     watch.restore()
Example #4
0
 def tearDown(self):
     watch.restore()
     return super().tearDown()