Exemple #1
0
 def test_eq_left_and_right_neq(self):
     # Arrange.
     l1 = MockBE(False)
     r1 = MockBE(False)
     b1 = BE(l1, r1)
     l2 = MockBE(False)
     r2 = MockBE(False)
     b2 = BE(l1, r1)
     self.assertEqual(b1 == b2, False)
Exemple #2
0
 def test_eq(self):
     # Arrange.
     l1 = MockBE(True)
     r1 = MockBE(True)
     b1 = BE(l1, r1)
     l2 = MockBE(True)
     r2 = MockBE(True)
     b2 = BE(l1, r1)
     self.assertEqual(b1 == b2, True)
Exemple #3
0
 def test_var_eq(self):
     # Arrange.
     l = Idea()
     r = Idea()
     b = BE(l, r)
     v = BE(Idea(), Idea())
     e = Idea()
     # Act.
     s = b.subst(Idea(), v)
     # Assert.
     self.assertEqual(s, e)
Exemple #4
0
 def test_var_neq_req(self):
     # Arrange.
     l = Idea()
     r = BE(Idea(), Idea())
     b = BE(l, r)
     e = Idea()
     # Act.
     s = b.subst(e, BE(Idea(), Idea()))
     # Assert.
     self.assertIsNot(s, b)
     self.assertIsNot(s.l, l)
     self.assertIsNot(s.r, r)
     self.assertEqual(s, BE(Idea(), Idea()))
Exemple #5
0
 def test_neq_different_types(self):
     # Arrange.
     l1 = MockBE(True)
     r1 = MockBE(True)
     b1 = BE(l1, r1)
     b2 = MockBE(True)
     self.assertEqual(b1 == b2, False)
Exemple #6
0
 def test_str(self):
     # Arrange.
     b = BE(I(), I())
     # Act.
     s = str(b)
     # Assert.
     self.assertEqual(s, "(IBEI)")
Exemple #7
0
 def test_repr(self):
     # Arrange.
     l = MockBE(True, "L")
     r = MockBE(True, "R")
     b = BE(l, r)
     expected = "BE(L,R)"
     # Assert.
     self.assertEqual(repr(b), expected)
Exemple #8
0
 def test_repr_check(self):
     # Arrange.
     b = BE(I(), I())
     # Act.
     r = repr(b)
     e = eval(r)
     # Assert.
     self.assertEqual(r, "BE(I(),I())")
     self.assertEqual(e, b)
Exemple #9
0
 def test_eq_is_reflexive(self):
     # Arrange.
     b = BE(Idea(), Idea())
     # Act & Assert.
     self.assertEqual(b == b, True)