def check_frozenclass(cls, name): """Check if <simpledict class>.frozen `cls` has correct `name` and bases. """ assert cls.__name__ == name + '.frozen' # check bases the direct way assert issubclass(cls, simpledict.base) assert issubclass(cls, simpledict.frozenbase) assert not issubclass(cls, simpledict.structbase) # and with the according checker functions (to implicitly test them) assert issimpledictclass(cls) assert issimplefrozendictclass(cls) assert not issimpledictstructclass(cls)
def check_structclass(cls, name): """Check if <simpledict class>.struct `cls` has correct `name`, bases and slots. """ assert cls.__name__ == name + '.struct' # check bases the direct way assert issubclass(cls, simpledict.base) assert not issubclass(cls, simpledict.frozenbase) assert issubclass(cls, simpledict.structbase) # and with the according checker functions (to implicitly test them) assert issimpledictclass(cls) assert not issimplefrozendictclass(cls) assert issimpledictstructclass(cls) assert cls.__slots__ == ['__name__', '__bases__']