My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /src/lepl/rxpy/engine/lexer/_test/lexer.py
a9fcd7366d1c vs. 7bccdac7cd5e Compare: vs.  Format:
Revision 7bccdac7cd5e
Go to: 
Project members, sign in to write a code review
/src/lepl/rxpy/engine/lexer/_test/lexer.py   a9fcd7366d1c /src/lepl/rxpy/engine/lexer/_test/lexer.py   7bccdac7cd5e
1 #LICENCE 1 #LICENCE
2 2
3 from unittest.case import TestCase 3 from unittest import TestCase
4 4
5 from lepl.rxpy.engine._test.base import BaseTest 5 from lepl.rxpy.engine._test.base import BaseTest
6 from lepl.rxpy.engine.lexer.engine import LexerEngine 6 from lepl.rxpy.engine.lexer.engine import LexerEngine
7 7
8 8
9 class LexerTest(BaseTest, TestCase): 9 class LexerTest(BaseTest, TestCase):
10 10
11 def default_engine(self): 11 def default_engine(self):
12 return LexerEngine 12 return LexerEngine
13 13
14 def test_unique_group(self): 14 def test_unique_group(self):
15 self.assert_groups('^(?:(a)|(b)|(c))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)}) 15 self.assert_groups('^(?:(a)|(b)|(c))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)})
16 self.assert_groups('^(?:(a)|(b)|(c))', 'b', {0: ('b', 0, 1), 2: ('b', 0, 1)}) 16 self.assert_groups('^(?:(a)|(b)|(c))', 'b', {0: ('b', 0, 1), 2: ('b', 0, 1)})
17 self.assert_groups('^(?:(a)|(b)|(c))', 'c', {0: ('c', 0, 1), 3: ('c', 0, 1)}) 17 self.assert_groups('^(?:(a)|(b)|(c))', 'c', {0: ('c', 0, 1), 3: ('c', 0, 1)})
18 18
19 def test_duplicate_group(self): 19 def test_duplicate_group(self):
20 self.assert_groups('^(?:(a)|(a)|(a))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)}) 20 self.assert_groups('^(?:(a)|(a)|(a))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)})
21 self.assert_groups('^(?:(a)|(b)|(b))', 'b', {0: ('b', 0, 1), 2: ('b', 0, 1)}) 21 self.assert_groups('^(?:(a)|(b)|(b))', 'b', {0: ('b', 0, 1), 2: ('b', 0, 1)})
22 self.assert_groups('^(?:(c)|(b)|(c))', 'c', {0: ('c', 0, 1), 1: ('c', 0, 1)}) 22 self.assert_groups('^(?:(c)|(b)|(c))', 'c', {0: ('c', 0, 1), 1: ('c', 0, 1)})
23 23
24 def test_length(self): 24 def test_length(self):
25 self.assert_groups('^(?:(a)|(aa)|(aaa))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)}) 25 self.assert_groups('^(?:(a)|(aa)|(aaa))', 'a', {0: ('a', 0, 1), 1: ('a', 0, 1)})
26 self.assert_groups('^(?:(aaa)|(aa)|(a))', 'aaa', {0: ('aaa', 0, 3), 1: ('aaa', 0, 3)}) 26 self.assert_groups('^(?:(aaa)|(aa)|(a))', 'aaa', {0: ('aaa', 0, 3), 1: ('aaa', 0, 3)})
27 27
Powered by Google Project Hosting