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

Method test_subclass_override

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

Source from the content-addressed store, hash-verified

1212 self.assertEqual(b.t, f)
1213
1214 def test_subclass_override(self):
1215 class Foo(HasTraits):
1216 t = This["Foo"]()
1217
1218 class Bar(Foo):
1219 t = This()
1220
1221 f = Foo()
1222 b = Bar()
1223 f.t = b
1224 self.assertEqual(f.t, b)
1225 self.assertRaises(TraitError, setattr, b, "t", f)
1226
1227 def test_this_in_container(self):
1228 class Tree(HasTraits):

Callers

nothing calls this directly

Calls 2

FooClass · 0.70
BarClass · 0.70

Tested by

no test coverage detected