Пример #1
0
    def test_get(self):
        class Klass1: pass

        class InnerClass:
            pass

        idc = InheritedDataChain(InnerClass)
        self.assertIsNone(idc.get(Klass1))
        self.assertEqual(-1, idc.get(Klass1, -1))

        instance1 = idc[Klass1]
        self.assertEqual(instance1, idc.get(Klass1))
Пример #2
0
    def test_del(self):
        class Klass1: pass

        class InnerClass:
            pass

        idc = InheritedDataChain(InnerClass)
        __ = idc[Klass1]

        del idc[Klass1]
        self.assertIsNone(idc.get(Klass1))