コード例 #1
0
 def test_clbit_hash_update_index(self):
     orig_reg = mock.MagicMock(spec=classicalregister.ClassicalRegister)
     orig_reg.size = 42
     test_bit = classicalregister.Clbit(orig_reg, 0)
     orig_hash = hash(test_bit)
     test_bit.index = 2
     new_hash = hash(test_bit)
     self.assertNotEqual(orig_hash, new_hash)
コード例 #2
0
 def test_clbit_hash_update_reg(self):
     orig_reg = mock.MagicMock(spec=classicalregister.ClassicalRegister)
     orig_reg.size = 5
     new_reg = mock.MagicMock(spec=classicalregister.ClassicalRegister)
     new_reg.size = 53
     test_bit = classicalregister.Clbit(orig_reg, 0)
     orig_hash = hash(test_bit)
     test_bit.register = new_reg
     new_hash = hash(test_bit)
     self.assertNotEqual(orig_hash, new_hash)