Example #1
0
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))
Example #2
0
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))
Example #3
0
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))
Example #4
0
def test_sshash_different_lists_different_results():
    a = [1, 2, 3]
    b = [1, 2, 4]
    assert_not_equal(sshash(a), sshash(b))
Example #5
0
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))
Example #6
0
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.))
Example #7
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))
Example #8
0
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))
Example #9
0
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))
Example #10
0
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))
Example #11
0
def test_sshash_different_lists_different_results():
    a = [1, 2, 3]
    b = [1, 2, 4]
    assert_not_equal(sshash(a), sshash(b))
Example #12
0
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))
Example #13
0
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.))
Example #14
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))
Example #15
0
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))
Example #16
0
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))
Example #17
0
def test_sshash_different_user_defined_types_different_results():
    f1 = foo(5)
    f2 = foo(7)
    assert_not_equal(sshash(f1), sshash(f2))
Example #18
0
def test_sshash_different_user_defined_types_different_results():
    f1 = foo(5)
    f2 = foo(7)
    assert_not_equal(sshash(f1), sshash(f2))
Example #19
0
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))
Example #20
0
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))