Skip to content

Commit bae4dcb

Browse files
committed
Refactor test for group possibilities to enhance clarity and reduce redundancy
1 parent c407e09 commit bae4dcb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/test_groups.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,12 @@ def test_group_with_multiple_elements_with_qunatifiers():
112112
possibilities = ['']
113113
char_class = ['', 'b', 'c', 'd', 'bb', 'bc',
114114
'bd', 'cb', 'cc', 'cd', 'db', 'dc', 'dd']
115-
one_group = [f'a{c}' for c in char_class]
116-
two_groups = [f'a{c1}a{c2}' for c1 in char_class for c2 in char_class]
117-
three_groups = [f'a{c1}a{c2}a{
118-
c3}' for c1 in char_class for c2 in char_class for c3 in char_class]
119-
possibilities.extend(one_group)
120-
possibilities.extend(two_groups)
121-
possibilities.extend(three_groups)
115+
one = [f'a{c}' for c in char_class]
116+
two = [f'{c1}{c2}' for c1 in one for c2 in one]
117+
three = [f'{c1}{c2}{c3}' for c1 in one for c2 in one for c3 in one]
118+
possibilities.extend(one)
119+
possibilities.extend(two)
120+
possibilities.extend(three)
122121

123122
f_finite(regexEnumerator, set(possibilities))
124123

0 commit comments

Comments
 (0)