Skip to content
Prev Previous commit
b. improve unit-test
  • Loading branch information
wjssz committed Apr 3, 2022
commit e95b19f63d36ede3525303e5363738d206083d47
6 changes: 3 additions & 3 deletions Lib/test/test_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -2338,8 +2338,8 @@ def test_possesive_repeat(self):
''')

def test_repeat_index(self):
self.assertEqual(get_debug_out(r'(?:ab)*(?:cd)*'), '''\
MAX_REPEAT 0 MAXREPEAT
self.assertEqual(get_debug_out(r'(?:ab)*?(?:cd)*'), '''\
MIN_REPEAT 0 MAXREPEAT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just read my mind! I was going to propose such a change, but I thought that I was already bothering you too much.

Copy link
Copy Markdown
Author

@ghost ghost Apr 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought this after posting this PR.

I thought that I was already bothering you too much.

As an inactive contributor, this is not a matter.
I'm not practised, so need continuously improve the patch to get to a good state.
When I think it's good, I can always find its shortcomings afterwards.

I have only one question: how to prove that we need only one SRE_REPEAT structure per the REPEAT code?

I have to think about how to answer your question.

LITERAL 97
LITERAL 98
MAX_REPEAT 0 MAXREPEAT
Expand All @@ -2350,7 +2350,7 @@ def test_repeat_index(self):
5: REPEAT 8 0 MAXREPEAT 0 (to 14)
10. LITERAL 0x61 ('a')
12. LITERAL 0x62 ('b')
14: MAX_UNTIL
14: MIN_UNTIL
15. REPEAT 8 0 MAXREPEAT 1 (to 24)
20. LITERAL 0x63 ('c')
22. LITERAL 0x64 ('d')
Expand Down