def test_not_equal_name(self): wrapped_observer = DummyObserver() observer1 = _RestrictedNamedTraitObserver( name="name", wrapped_observer=wrapped_observer) observer2 = _RestrictedNamedTraitObserver( name="other", wrapped_observer=wrapped_observer) self.assertNotEqual(observer1, observer2)
def test_equality_name_and_observer(self): wrapped_observer = DummyObserver() observer1 = _RestrictedNamedTraitObserver( name="name", wrapped_observer=wrapped_observer) observer2 = _RestrictedNamedTraitObserver( name="name", wrapped_observer=wrapped_observer) self.assertEqual(observer1, observer2) self.assertEqual(hash(observer1), hash(observer2))
def test_maintainer_inherited(self): maintainer = DummyNotifier() wrapped_observer = DummyObserver(maintainer=maintainer) observer = _RestrictedNamedTraitObserver( name="name", wrapped_observer=wrapped_observer) self.assertEqual( observer.get_maintainer(None, None, None, None), maintainer, )
def test_notify_inherited(self): wrapped_observer = DummyObserver(notify=False) observer = _RestrictedNamedTraitObserver( name="name", wrapped_observer=wrapped_observer) self.assertEqual(observer.notify, wrapped_observer.notify)