Exemple #1
0
    def test_exclusion_list(self):
        # Ignore an instance:
        a = Facade(TestA())

        b = a.getb()
        self.assertEquals( b.__class__, Wrapper )

        a.wrapper__ignore( TestB )
        b = a.getb()
        self.assertEquals( b.__class__, TestB )

        a.wrapper__unignore( TestB )
        b = a.getb()
        self.assertEquals( b.__class__, Wrapper )

        # Ignore a class:
        c = Facade(TestC())

        self.assertTrue( c.test_a_class().__class__, Wrapper )

        c.wrapper__ignore( TestA )
        a = c.test_a_class()
        self.assertTrue( isinstance( a, TestA ) )
    def test_exclusion_list(self):
        # Ignore an instance:
        a = Facade(TestA())

        b = a.getb()
        self.assertEquals(b.__class__, Wrapper)

        a.wrapper__ignore(TestB)
        b = a.getb()
        self.assertEquals(b.__class__, TestB)

        a.wrapper__unignore(TestB)
        b = a.getb()
        self.assertEquals(b.__class__, Wrapper)

        # Ignore a class:
        c = Facade(TestC())

        self.assertTrue(c.test_a_class().__class__, Wrapper)

        c.wrapper__ignore(TestA)
        a = c.test_a_class()
        self.assertTrue(isinstance(a, TestA))