def test_sshash_equal_user_defined_types_equal_results(): class foo(object): def __init__(self, a): self.a = a f1 = foo(5) f2 = foo(7) assert_not_equal(sshash(f1), sshash(f2))
def test_sshash_equal_dicts_equal_results(): a = {'a':1, 'b':2, 'c':3} b = {'a':1, 'b':2, 'c':3} assert_not_equal(id(a), id(b)) assert_equal(sshash(a), sshash(b))
def test_sshash_different_lists_different_results(): a = [1, 2, 3] b = [1, 2, 4] assert_not_equal(sshash(a), sshash(b))
def test_sshash_equal_lists_equal_results(): a = [1, 2, 3] b = [1, 2, 3] assert_not_equal(id(a), id(b)) assert_equal(sshash(a), sshash(b))
def test_sshash_distinct_float_hashes(): assert_not_equal(sshash(1.), sshash(2.)) assert_not_equal(sshash(-1.), sshash(1.)) assert_not_equal(sshash(0.), sshash(1.)) assert_not_equal(sshash(1000.), sshash(1001.)) assert_not_equal(sshash(.0001), sshash(0.))
def test_sshash_distinct_int_hashes(): assert_not_equal(sshash(1), sshash(2)) assert_not_equal(sshash(-1), sshash(1)) assert_not_equal(sshash(0), sshash(1)) assert_not_equal(sshash(1000), sshash(1001))
def test_sshash_different_shape_nparrays_different_results(): a = np.arange(12).reshape(3,4) b = np.arange(12).reshape(4,3) assert_not_equal(sshash(a), sshash(b))
def test_sshash_different_dicts_different_results(): a = {'a': 1, 'b': 2, 'c': 3} b = {'a': 1, 'b': 7, 'c': 3} assert_not_equal(sshash(a), sshash(b))
def test_sshash_equal_dicts_equal_results(): a = {'a': 1, 'b': 2, 'c': 3} b = {'a': 1, 'b': 2, 'c': 3} assert_not_equal(id(a), id(b)) assert_equal(sshash(a), sshash(b))
def test_sshash_different_type_nparrays_different_results(): a = np.arange(12, dtype=np.uint8).reshape(3, 4) b = np.arange(12, dtype=np.uint16).reshape(3, 4) assert_not_equal(sshash(a), sshash(b))
def test_sshash_different_dicts_different_results(): a = {'a':1, 'b':2, 'c':3} b = {'a':1, 'b':7, 'c':3} assert_not_equal(sshash(a), sshash(b))
def test_sshash_different_user_defined_types_different_results(): f1 = foo(5) f2 = foo(7) assert_not_equal(sshash(f1), sshash(f2))
def test_sshash_different_type_nparrays_different_results(): a = np.arange(12, dtype=np.uint8).reshape(3,4) b = np.arange(12, dtype=np.uint16).reshape(3,4) assert_not_equal(sshash(a), sshash(b))
def test_sshash_different_nparrays_different_results(): a = np.arange(12).reshape(3, 4) b = np.arange(1, 13).reshape(3, 4) assert_not_equal(sshash(a), sshash(b))