Exemplo n.º 1
0
 def test_exclude(self):
     tracer = VizTracer()
     tracer.start()
     a = VizObject(tracer, "my variable", exclude_attributes=["b", "c"])
     a.hello = 1
     a.b = 2
     a.c = 3
     a.lol = 4
     tracer.stop()
     entries = tracer.parse()
     self.assertEqual(entries, 3)
Exemplo n.º 2
0
 def test_config(self):
     tracer = VizTracer()
     tracer.start()
     a = VizObject(tracer, "my variable")
     a.config("trigger_on_change", False)
     a.hello = 1
     a.b = 2
     a.c = 3
     a.lol = 4
     a.log()
     tracer.stop()
     del a
     entries = tracer.parse()
     self.assertEqual(entries, 2)
Exemplo n.º 3
0
 def test_trigger_on_change(self):
     tracer = VizTracer()
     tracer.stop()
     tracer.cleanup()
     tracer.start()
     a = VizObject(tracer, "my variable", trigger_on_change=False)
     a.hello = 1
     a.b = 2
     a.c = 3
     a.lol = 4
     a.log()
     tracer.stop()
     entries = tracer.parse()
     self.assertEqual(entries, 2)
Exemplo n.º 4
0
 def test_config(self):
     tracer = VizTracer()
     tracer.start()
     a = VizObject(tracer, "my variable")
     a.config("trigger_on_change", False)
     a.hello = 1
     a.b = 2
     a.c = 3
     a.lol = 4
     a.log()
     tracer.stop()
     entries = tracer.parse()
     self.assertEqual(entries, 2)
     with self.assertRaises(ValueError):
         a.config("invalid", "value")