Python abc.get_cache_token() Examples

The following are 3 code examples of abc.get_cache_token(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module abc , or try the search function .
Example #1
Source File: test_abc.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_isinstance_invalidation(self):
        class A(metaclass=abc.ABCMeta):
            pass
        class B:
            pass
        b = B()
        self.assertFalse(isinstance(b, A))
        self.assertFalse(isinstance(b, (A,)))
        token_old = abc.get_cache_token()
        A.register(B)
        token_new = abc.get_cache_token()
        self.assertNotEqual(token_old, token_new)
        self.assertTrue(isinstance(b, A))
        self.assertTrue(isinstance(b, (A,))) 
Example #2
Source File: test_abc.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_isinstance_invalidation(self):
        class A(metaclass=abc.ABCMeta):
            pass
        class B:
            pass
        b = B()
        self.assertFalse(isinstance(b, A))
        self.assertFalse(isinstance(b, (A,)))
        token_old = abc.get_cache_token()
        A.register(B)
        token_new = abc.get_cache_token()
        self.assertNotEqual(token_old, token_new)
        self.assertTrue(isinstance(b, A))
        self.assertTrue(isinstance(b, (A,))) 
Example #3
Source File: test_abc.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_isinstance_invalidation(self):
        class A(metaclass=abc.ABCMeta):
            pass
        class B:
            pass
        b = B()
        self.assertFalse(isinstance(b, A))
        self.assertFalse(isinstance(b, (A,)))
        token_old = abc.get_cache_token()
        A.register(B)
        token_new = abc.get_cache_token()
        self.assertNotEqual(token_old, token_new)
        self.assertTrue(isinstance(b, A))
        self.assertTrue(isinstance(b, (A,)))