There is a class named State that has several attributes, which I need to write unit tests for. The test will need to have certain actions that change attribute values of the State instance. Expected parameters are located inside of the dictionary. The unit test will compare the attributes of the State instance with the values of the dictionary for equality.
The question is what is the best place to keep the comparison logic at? I
was thinking about 2 options:

Add __eq__ method to the State class that contains comparison logic.
Add helper function inside of the test module that contains comparison logic.

Which one of the options is better and why?
You should probably take the __eq__ approach. This way you can also test for equality in the actual code in the future if necessary, while also being able to avoid a potentially messy situation with importing the helper function if you plan or might use type annotations in the future.
Generally you do not want your testing code to contain much logic at all, since test are meant to test code not implement more logic which may need to be tested itself. Beyond the actual test functions you test suites should be really very simple.
The only reason I can think to not take this approach is if the class you are testing has some unique use case where a __eq__ is not applicable and you want to avoid implementing one and potentially confusing yourself or future developers later on.
What is the correct way to test classes in Python?