def testMatrix(self): a = (257276184, [ [0, 0, -1, 0], [0, 1, 0, 0], [2, 0, 0, 0], [10, 0, 0, 1]]) b = (257276184, [ [2.2204460492503131e-16, 0.0, -1.0, 0.0], [0.0, 1.0, 0.0, 0.0], [2.0, 0.0, 4.4408920985006262e-16, 0.0], [10.0, 0.0, 0.0, 1.0]]) self.assertTrue(compare(a, b))
def testDictVsSet(self): a = {'a': 1, 'b': 2, 'c': 1.00000} b = set([1, 2, 3, 4]) self.assertFalse(compare(a, b))
def testDictVsList(self): a = {'a': 1, 'b': 2, 'c': 1.00000} b = [1, 2, 1.0000] self.assertFalse(compare(a, b))
def testIntVsFloat(self): self.assertTrue(compare(1.00, 1))
def assertCompare(self, val, eq, neq): self.assertTrue(compare(val, eq)) self.assertFalse(compare(val, neq))
def testObjVsDict(self): a = sphere() b = {'foo': 'bar'} self.assertFalse(compare(a, b)) self.assertFalse(compare(b, a))