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

Method test_notify_subclass

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

Source from the content-addressed store, hash-verified

488 self.assertEqual(b.b, 100.0)
489
490 def test_notify_subclass(self):
491 class A(HasTraits):
492 a = Int()
493
494 class B(A):
495 b = Float()
496
497 b = B()
498 b.on_trait_change(self.notify1, "a")
499 b.on_trait_change(self.notify2, "b")
500 b.a = 0
501 b.b = 0.0
502 self.assertEqual(len(self._notify1), 0)
503 self.assertEqual(len(self._notify2), 0)
504 b.a = 10
505 b.b = 10.0
506 self.assertTrue(("a", 0, 10) in self._notify1)
507 self.assertTrue(("b", 0.0, 10.0) in self._notify2)
508
509 def test_static_notify(self):
510 class A(HasTraits):

Callers

nothing calls this directly

Calls 2

on_trait_changeMethod · 0.80
BClass · 0.70

Tested by

no test coverage detected