base.py (808B)
1 # standard imports 2 import logging 3 4 # local imports 5 from eth_interface import ERC165 6 7 logg = logging.getLogger(__name__) 8 9 10 class TestERC165: 11 12 erc165_ifcs = [] 13 14 @classmethod 15 def flush_interface_check(cls): 16 cls.erc165_ifcs = [] 17 18 19 @classmethod 20 def add_interface_check(cls, ifc): 21 assert len(bytes.fromhex(ifc)) == 4 22 cls.erc165_ifcs.append(ifc) 23 24 25 def test_erc165_interfaces(self): 26 c = ERC165(self.chain_spec) 27 logg.info('will check interfaces: {}'.format(self.erc165_ifcs)) 28 for ifc in self.erc165_ifcs + ['01ffc9a7']: 29 logg.debug('checking ifc {}'.format(ifc)) 30 o = c.supports_interface(self.address, ifc, sender_address=self.accounts[0]) 31 r = self.rpc.do(o) 32 self.assertEqual(int(r, 16), 1)