Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python module equal override

class Failure:
    def __init__(self, suite: str, module: str, test: str, message: str):
        self.suite: str = suite
        self.module: str = module
        self.test: str = test
        self.message: str = message

    def __eq__(self, obj):
        return type(obj) is type(self) and obj.__dict__ == self.__dict__

    def any_match(self, obj_list: list[object] = []):
        return any(type(obj) is type(self) and obj.__dict__ == self.__dict__ for obj in obj_list)
 
PREVIOUS NEXT
Tagged: #python #module #equal #override
ADD COMMENT
Topic
Name
6+8 =