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

Method test_notify_one

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

Source from the content-addressed store, hash-verified

460 self.assertEqual(len(self._notify1), 0)
461
462 def test_notify_one(self):
463 class A(HasTraits):
464 a = Int()
465 b = Float()
466
467 a = A()
468 a.on_trait_change(self.notify1, "a")
469 a.a = 0
470 self.assertEqual(len(self._notify1), 0)
471 a.a = 10
472 self.assertTrue(("a", 0, 10) in self._notify1)
473 self.assertRaises(TraitError, setattr, a, "a", "bad string")
474
475 def test_subclass(self):
476 class A(HasTraits):

Callers

nothing calls this directly

Calls 2

on_trait_changeMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected