The "eq" method in the InvalidNumber class has a bug when comparing with dictionaries. Currently, it assumes "other" is always an InvalidNumber object and tries to access "other.dict", which fails when other is already a dictionary.
Current Implementation:
def __eq__(self, other): return other and self.__dict__ == other.__dict__
Expected Behavior:
The "eq" method should handle both InvalidNumber objects and dictionaries:
def __eq__(self, other): if other is None: return False if isinstance(other, dict): return self.__dict__ == other if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False
Branch:
Master
The "eq" method in the InvalidNumber class has a bug when comparing with dictionaries. Currently, it assumes "other" is always an InvalidNumber object and tries to access "other.dict", which fails when other is already a dictionary.
Current Implementation:
def __eq__(self, other): return other and self.__dict__ == other.__dict__Expected Behavior:
The "eq" method should handle both InvalidNumber objects and dictionaries:
def __eq__(self, other): if other is None: return False if isinstance(other, dict): return self.__dict__ == other if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return FalseBranch:
Master