MCPcopy Create free account
hub / github.com/ipython/traitlets / test_notify_one

Method test_notify_one

tests/test_traitlets.py:658–670  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

656 self.assertEqual(len(self._notify1), 0)
657
658 def test_notify_one(self):
659 class A(HasTraits):
660 a = Int()
661 b = Float()
662
663 a = A()
664 a.observe(self.notify1, "a")
665 a.a = 0
666 self.assertEqual(len(self._notify1), 0)
667 a.a = 10
668 change = change_dict("a", 0, 10, a, "change")
669 self.assertTrue(change in self._notify1)
670 self.assertRaises(TraitError, setattr, a, "a", "bad string")
671
672 def test_subclass(self):
673 class A(HasTraits):

Callers

nothing calls this directly

Calls 3

change_dictFunction · 0.85
observeMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected