def test_extended(self):

        class Child(HasTraits):
            i = Int

        class Parent(HasTraits):
            child = Instance(Child)

        # Create objects
        parent = Parent(child=Child())
        target = HasTraits()

        # Set up to count changes in i
        self.count = 0

        def count_notifies():
            self.count += 1
        parent.on_trait_change(count_notifies, "child:i", target=target)

        # Change the trait
        parent.child.i = 10
        # Delete the target and change it again
        del target
        parent.child.i = 0
        # The count should be 1
        self.assertEqual(self.count, 1)
Smarter experimental version of summarize.
dataset/ETHPy150Open enthought/traits/traits/tests/test_target.py/TestCase.test_extended--crossover with--dataset/ETHPy150Open brutasse/graphite-api/graphite_api/functions.py/smartSummarize