aboutsummaryrefslogtreecommitdiff
path: root/tests/compile
diff options
context:
space:
mode:
authornatsuoto <[email protected]>2026-07-16 17:31:49 +0530
committernatsuoto <[email protected]>2026-07-16 17:31:49 +0530
commit1b43c8dc09adb9b54609cc8a1916c99eb6fe75c9 (patch)
tree7731af50ed9117f8ac3d200591c3be23818d7b19 /tests/compile
parentb7ae2f3885d5ff84237c9da8bc0c64fe1a509465 (diff)
downloadedify-1b43c8dc09adb9b54609cc8a1916c99eb6fe75c9.tar.xz
edify-1b43c8dc09adb9b54609cc8a1916c99eb6fe75c9.zip
chore: enforce fully strict static typing across library, tests, and tooling with zero suppressions
Diffstat (limited to 'tests/compile')
-rw-r--r--tests/compile/escape.test.py4
-rw-r--r--tests/compile/redos.test.py14
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/compile/escape.test.py b/tests/compile/escape.test.py
index e9ab657..aeaff93 100644
--- a/tests/compile/escape.test.py
+++ b/tests/compile/escape.test.py
@@ -91,7 +91,7 @@ def test_char_terminal_still_uses_full_escape_outside_the_class():
@pytest.mark.parametrize("candidate", _MIXED_CORPUS)
-def test_normalized_and_over_escaped_char_classes_match_the_same_inputs(candidate):
+def test_normalized_and_over_escaped_char_classes_match_the_same_inputs(candidate: str):
normalized_pattern = (
RegexBuilder().any_of_chars(_METACHARS_UNRELATED_TO_CLASS).to_regex_string()
)
@@ -102,7 +102,7 @@ def test_normalized_and_over_escaped_char_classes_match_the_same_inputs(candidat
@pytest.mark.parametrize("candidate", _MIXED_CORPUS)
-def test_normalized_and_over_escaped_negated_classes_match_the_same_inputs(candidate):
+def test_normalized_and_over_escaped_negated_classes_match_the_same_inputs(candidate: str):
normalized_pattern = RegexBuilder().anything_but_chars("aeiou.-").to_regex_string()
over_escaped_pattern = "[^aeiou\\.\\-]"
normalized_hits = re.findall(normalized_pattern, candidate)
diff --git a/tests/compile/redos.test.py b/tests/compile/redos.test.py
index 91786bd..97618bb 100644
--- a/tests/compile/redos.test.py
+++ b/tests/compile/redos.test.py
@@ -41,28 +41,34 @@ def test_warning_message_names_both_quantifiers():
assert "engine='regex'" in message_text
-def test_bounded_quantifier_does_not_trigger_the_warning(recwarn):
+def test_bounded_quantifier_does_not_trigger_the_warning(recwarn: pytest.WarningsRecorder):
builder = RegexBuilder().exactly(3).group().exactly(2).digit().end()
builder.to_regex()
is_redos_flags = [isinstance(warning.message, ReDoSWarning) for warning in recwarn]
assert not any(is_redos_flags)
-def test_grouped_quantifier_over_a_composite_group_does_not_trigger(recwarn):
+def test_grouped_quantifier_over_a_composite_group_does_not_trigger(
+ recwarn: pytest.WarningsRecorder,
+):
builder = RegexBuilder().one_or_more().group().digit().letter().end()
builder.to_regex()
is_redos_flags = [isinstance(warning.message, ReDoSWarning) for warning in recwarn]
assert not any(is_redos_flags)
-def test_grouped_quantifier_over_a_single_non_quantifier_child_does_not_trigger(recwarn):
+def test_grouped_quantifier_over_a_single_non_quantifier_child_does_not_trigger(
+ recwarn: pytest.WarningsRecorder,
+):
builder = RegexBuilder().one_or_more().group().digit().end()
builder.to_regex()
is_redos_flags = [isinstance(warning.message, ReDoSWarning) for warning in recwarn]
assert not any(is_redos_flags)
-def test_sequential_unbounded_quantifiers_do_not_trigger_the_warning(recwarn):
+def test_sequential_unbounded_quantifiers_do_not_trigger_the_warning(
+ recwarn: pytest.WarningsRecorder,
+):
builder = RegexBuilder().one_or_more().digit().one_or_more().letter()
builder.to_regex()
is_redos_flags = [isinstance(warning.message, ReDoSWarning) for warning in recwarn]