title: How to assert two list with dicts without order?
body: <p>everyone. I recently switch from python 2 to 3.5.1 and there was an assert function, which I cannot rewrite.</p>
  
  <pre><code>def assertEqualUnordered(self, data1, data2):
      """
      compare that data are similar
      i.e.:
      [d1, d2] == [d2, d1]
      or
      {'a': [d1, d2]} == {'a': [d2, d1]}
      or
      [{'a': [d1, d2]}, {'b': [d3, d4]}] == [{'b': [d4, d3]}, {'a': [d2, d1]}]
      """
      if isinstance(data1, list) or isinstance(data1, tuple):
          self.assertEqual(len(data1), len(data2))
          for d1, d2 in zip(sorted(data1), sorted(data2)):
              self.assertEqualUnordered(d1, d2)
      elif isinstance(data1, dict):
          data1_keys = sorted(data1.keys())
          data2_keys = sorted(data2.keys())
          self.assertListEqual(data1_keys, data2_keys)
          for key in data1_keys:
              self.assertEqualUnordered(data1[key], data2[key])
      else:
          self.assertEqual(data1, data2)
  </code></pre>
  
  <p>In general this code works normal, but if d1 and d2 are dicts, than I've got: </p>
  
  <p><code>TypeError: unorderable types: dict() &lt; dict()</code></p>
  
  <p>How can I rewrite it to work in py3k?</p>
  
  <p><strong>EDIT 1:</strong>
  Simplify code example:</p>
  
  <pre><code>def assertEqualUnordered(data1, data2):
      assert len(data1) == len(data2)
      for d1, d2 in zip(sorted(data1), sorted(data2)):
          assert d1 == d2
  
  data1 = [{'a': 'a'}, {'b': 'b'}]
  data2 = [{'b': 'b'}, {'a': 'a'}]
  assertEqualUnordered(data1, data2)
  </code></pre>