def testSameHashParams(self): """If the args are substituted after creation, the hash shouldn't change""" def a(arg1, arg2): return arg1+arg2 fc = FunctionCall(a, {'arg1' : 1, 'arg2' : 2}) hash1 = fc.__hash__() fc.funcArgs = {'arg1' : 2, 'arg2' : 'something else'} hash2 = fc.__hash__() self.assert_(hash1 == hash2)
def testSameHashFunc(self): """If the function is substituted after creation, the hash shouldn't change""" def a(): pass def b(): return "asdf" fc = FunctionCall(a) hash1 = fc.__hash__() fc.func = b hash2 = fc.__hash__() self.assert_(hash1 == hash2)