[TESTING] Notification equality uses string representation
matiboy opened this issue · comments
matiboy commented
Describe the bug
The test for equality of Notifications in tests uses str equality instead of equality leading to false negatives
To Reproduce
ReactiveTest.on_next(300, Decimal(0)) == ReactiveTest.on_next(300, Decimal("0.0")) # false even though Decimal(0) == Decimal("0.0") is true
ReactiveTest.on_next(300, {"a": 42, "b": 5}) == ReactiveTest.on_next(300,
{"b": 5, "a": 42}) # false though {"a": 42, "b": 5} == {"b": 5, "a": 42} is True
Expected behavior
Above examples should be equal
Code or Screenshots
This is caused by using string inside class Notification(Generic[_T]):
def equals(self, other: "Notification[_T]") -> bool:
"""Indicates whether this instance and a specified object are
equal."""
other_string = "" if not other else str(other)
return str(self) == other_string
- RxPY version: 4.0.4
- Python version: 3.11.2
matiboy commented