コード例 #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)