Example #1
0
    def test_single_operator(self):
        m = 1
        n = 0
        res = mccoy(self.mode, self.op_a, self.op_b, m, n)
        expected = {((0, self.op_a),): 1.0}
        self.assertEqual(res, expected)

        m = 0
        n = 1
        res = mccoy(self.mode, self.op_a, self.op_b, m, n)
        expected = {((0, self.op_b),): 1.0}
        self.assertEqual(res, expected)
Example #2
0
    def test_squared(self):
        m = 2
        n = 0
        res = mccoy(self.mode, self.op_a, self.op_b, m, n)
        expected = {((0, self.op_a), (0, self.op_a)): 1.0}
        self.assertEqual(res, expected)

        m = 0
        n = 2
        res = mccoy(self.mode, self.op_a, self.op_b, m, n)
        expected = {((0, self.op_b), (0, self.op_b)): 1.0}
        self.assertEqual(res, expected)
Example #3
0
 def test_mixed(self):
     m = 1
     n = 1
     res = mccoy(self.mode, self.op_a, self.op_b, m, n)
     expected = {((0, self.op_a), (0, self.op_b)): 0.5,
                 ((0, self.op_b), (0, self.op_a)): 0.5}
     self.assertEqual(res, expected)
Example #4
0
 def test_identity(self):
     m = 0
     n = 0
     res = mccoy(self.mode, self.op_a, self.op_b, m, n)
     expected = {tuple(): 1.0}
     self.assertEqual(res, expected)