예제 #1
0
 def test_many(self):
     rule = easyparse.many(easyparse.PatternRule('a'))
     self.assertEqual((True, easyparse.Ignored), rule.parse(''))
     for i in range(1, 5):
         self.assertEqual((True, ['a']), rule.parse('a ' * i))
     for i in range(1, 5):
         self.assertEqual((True, ['a'] * i), rule.parse('a' * i))
예제 #2
0
 def test_many(self):
     rule = easyparse.many(easyparse.PatternRule('a'))
     self.assertEqual((True, easyparse.Ignored), rule.parse(''))
     for i in range(1,5):
         self.assertEqual((True, ['a']), rule.parse('a ' * i))
     for i in range(1,5):
         self.assertEqual((True, ['a'] * i), rule.parse('a' * i))
예제 #3
0
 def test_parse_large_stack_with_many(self):
     rule = easyparse.many(easyparse.parse('a'))
     ok, result = rule.parse('a' * 1000)
     self.assertTrue(ok)
     self.assertEqual(['a'] * 1000, result)
예제 #4
0
 def test_parse_large_stack_with_many(self):
     rule = easyparse.many(easyparse.parse('a'))
     ok, result = rule.parse('a' * 1000)
     self.assertTrue(ok)
     self.assertEqual(['a'] * 1000, result)