Skip to content

Commit 3cfbd0f

Browse files
committed
Update tests for enhanced string mutations
- Adjust test expectations for new string operator behavior - Tests now account for XX prefix/suffix, uppercase, and capitalize mutations
1 parent ceacaae commit 3cfbd0f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/test_integration_mutations.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ def test_number_mutations_comprehensive(self):
5757

5858
def test_string_mutations_and_false_positive_prevention(self):
5959
"""Test string mutations and ensure docstrings are not mutated."""
60-
# Regular strings should be mutated
60+
# Regular strings should be mutated
6161
node = cst.SimpleString('"hello"')
6262
mutations = list(operator_string(node))
63-
assert len(mutations) == 1
64-
assert mutations[0].value == '"XXhelloXX"'
63+
# Now includes XX prefix/suffix, uppercase, and capitalize mutations
64+
assert len(mutations) == 3
65+
mutation_values = [m.value for m in mutations]
66+
assert '"XXhelloXX"' in mutation_values
67+
assert '"HELLO"' in mutation_values
68+
assert '"Hello"' in mutation_values
6569

6670
# Docstrings should NOT be mutated (false positive prevention)
6771
docstring_cases = [

tests/test_node_mutation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ class TestOperatorString:
3131
def test_simple_string_mutation(self):
3232
node = cst.SimpleString('"hello"')
3333
mutations = list(operator_string(node))
34-
assert len(mutations) == 1
35-
assert mutations[0].value == '"XXhelloXX"'
34+
# Now includes XX prefix/suffix, uppercase, and capitalize mutations
35+
assert len(mutations) == 3
36+
mutation_values = [m.value for m in mutations]
37+
assert '"XXhelloXX"' in mutation_values
38+
assert '"HELLO"' in mutation_values
39+
assert '"Hello"' in mutation_values
3640

3741
def test_triple_quoted_string_ignored(self):
3842
node = cst.SimpleString('"""docstring"""')

0 commit comments

Comments
 (0)