Пример #1
0
    def test_tuples(self):
        t1 = (1, 2, 3)
        t2 = (1, 2, 3)
        self.assertTrue(t1 is not t2)

        self.assertEqual(StableHashFunction.stableShaHashForObject(t1, True),
                         StableHashFunction.stableShaHashForObject(t2, True))
Пример #2
0
    def test_tuples(self):
        t1 = (1,2,3)
        t2 = (1,2,3)
        self.assertTrue(t1 is not t2)

        self.assertEqual(
            StableHashFunction.stableShaHashForObject(t1, True),
            StableHashFunction.stableShaHashForObject(t2, True)
            )
Пример #3
0
    def test_tuples_2(self):
        t1 = ("a", unicode("s"), type(10))
        t2 = ("a", unicode("s"), type(10))
        t3 = ("b", unicode("s"), type(10))

        self.assertTrue(t1 is not t2)

        self.assertEqual(StableHashFunction.stableShaHashForObject(t1, True),
                         StableHashFunction.stableShaHashForObject(t2, True))
        self.assertNotEqual(
            StableHashFunction.stableShaHashForObject(t1, True),
            StableHashFunction.stableShaHashForObject(t3, True))
Пример #4
0
    def test_tuples_2(self):
        t1 = ("a", unicode("s"), type(10))
        t2 = ("a", unicode("s"), type(10))
        t3 = ("b", unicode("s"), type(10))

        self.assertTrue(t1 is not t2)

        self.assertEqual(
            StableHashFunction.stableShaHashForObject(t1, True),
            StableHashFunction.stableShaHashForObject(t2, True)
            )
        self.assertNotEqual(
            StableHashFunction.stableShaHashForObject(t1, True),
            StableHashFunction.stableShaHashForObject(t3, True)
            )
Пример #5
0
def hashComputedGraphLocation(loc, unhashableObjectPolicy):
    return StableHashFunction.stableShaHashForObject(
        (loc.__location_class__, loc.__reduce__()),
        unhashableObjectPolicy
        )
Пример #6
0
def hashComputedGraphLocation(loc, unhashableObjectPolicy):
    return StableHashFunction.stableShaHashForObject(
        (loc.__location_class__, loc.__reduce__()), unhashableObjectPolicy)