Example #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))
    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)
            )
Example #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))
    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)
            )
Example #5
0
def hashComputedGraphLocation(loc, unhashableObjectPolicy):
    return StableHashFunction.stableShaHashForObject(
        (loc.__location_class__, loc.__reduce__()),
        unhashableObjectPolicy
        )
Example #6
0
def hashComputedGraphLocation(loc, unhashableObjectPolicy):
    return StableHashFunction.stableShaHashForObject(
        (loc.__location_class__, loc.__reduce__()), unhashableObjectPolicy)