Use assertEquals with object fields instead of instances.

Directly comparing objects with assertEquals requires them to either be the same
object instance or to provide the `__eq__` operator.