Пример #1
0
 def testDuplicateBranchInAlternative(self):
     a = builder.makeAlternative(
         [Terminal("bar"),
          Terminal("foo"),
          Terminal("bar"), Null])
     b = Alternative([Terminal("bar"), Terminal("foo"), Null])
     self.assertEqual(a, b)
Пример #2
0
 def testMultipleSimplifcationSteps(self):
     a = builder.makeAlternative([Terminal("bar"), Alternative([Terminal("bar"), Terminal("bar")])])
     b = Terminal("bar")
     self.assertEqual(a, b)
Пример #3
0
 def testDuplicateBranchInAlternative(self):
     a = builder.makeAlternative([Terminal("bar"), Terminal("foo"), Terminal("bar"), Null])
     b = Alternative([Terminal("bar"), Terminal("foo"), Null])
     self.assertEqual(a, b)
Пример #4
0
 def testAlternativeInAlternative(self):
     a = builder.makeAlternative([Terminal("foo"), Alternative([Terminal("bar"), Terminal("baz")])])
     b = Alternative([Terminal("foo"), Terminal("bar"), Terminal("baz")])
     self.assertEqual(a, b)
Пример #5
0
 def testAlternativeWithOneBranch(self):
     a = builder.makeAlternative([Terminal("foo")])
     b = Terminal("foo")
     self.assertEqual(a, b)
Пример #6
0
 def testMultipleSimplifcationSteps(self):
     a = builder.makeAlternative(
         [Terminal("bar"),
          Alternative([Terminal("bar"), Terminal("bar")])])
     b = Terminal("bar")
     self.assertEqual(a, b)
Пример #7
0
 def testAlternativeInAlternative(self):
     a = builder.makeAlternative(
         [Terminal("foo"),
          Alternative([Terminal("bar"), Terminal("baz")])])
     b = Alternative([Terminal("foo"), Terminal("bar"), Terminal("baz")])
     self.assertEqual(a, b)
Пример #8
0
 def testAlternativeWithOneBranch(self):
     a = builder.makeAlternative([Terminal("foo")])
     b = Terminal("foo")
     self.assertEqual(a, b)