class SaneEqualityArray(numpy.ndarray):

    def __eq__(self, other):
        return isinstance(other, SaneEqualityArray
            ) and self.shape == other.shape and numpy.ndarray.__eq__(self,
            other).all()


class TestAsserts(unittest.TestCase):

    def testAssert(self):
        tests = [[1, 2], {'foo': 2}, [2, 'foo', {'d': 4}],
            SaneEqualityArray([1, 2]), {'foo': {'hey': SaneEqualityArray([2,
            3])}}, [{'foo': SaneEqualityArray([3, 4]), 'd': {'doo': 3}},
            SaneEqualityArray([5, 6]), 34]]
for t in tests:
    self.assertEqual(t, copy.deepcopy(t))
if __name__ == '__main__':
    unittest.main()
Сравните (подтвердите равенство) две сложные структуры данных, содержащие массивы numpy, в unittest