title: Check if two objects have equal content in Pytest
body: <p>I'm learning how to use Pytest (and unit testing in general) and I would like to write a test to check if two objects of the same class have identical attributes.</p>
  
  <p>Example:</p>
  
  <pre><code>class Something(object):
      def __init__(self, a, b):
          self.a, self.b = a, b
  
      def __repr__(self):
          return 'Something(a={}, b={})'.format(self.a, self.b)
  
  def test_equality():
      obj1 = Something(1, 2)
      obj2 = Something(1, 2)
      assert obj1.a == obj2.a
      assert obj1 == obj2
  </code></pre>
  
  <p>This test fails with AssertionError on third assert:</p>
  
  <pre><code>    def test_equality():
          obj1 = Something(1, 2)
          obj2 = Something(1, 2)
          assert obj1.a == obj2.a
          assert obj1.b == obj2.b                                                                                                                                                                                                               
  &gt;       assert obj1 == obj2                                                                                                                                                                                                                   
  E       assert Something(a=1, b=2) == Something(a=1, b=2)                                                                                                                                                                                     
  
  tests/test_model.py:13: AssertionError
  </code></pre>
  
  <p>It is possible in Python or Pytest to use just <code>assert obj1 == obj2</code>? Should I implement "rich comparison" methods for each class I would like to test that way or there is some simpler way?</p>