ReactiveX / RxPY

ReactiveX for Python

Home Page:https://rxpy.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TESTING] Notification equality uses string representation

matiboy opened this issue · comments

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

Just realized that this is a duplicate of #599

@dbrattli Are we still looking for a PR to fix this? I can give it a go...

Also, closing the issue as duplicate

Duplicate of #599