diff options
| author | natsuoto <[email protected]> | 2026-07-01 15:36:40 +0530 |
|---|---|---|
| committer | natsuoto <[email protected]> | 2026-07-01 15:36:40 +0530 |
| commit | a7974d090211955c394e0fecbc547f73b7786a97 (patch) | |
| tree | 890106bf873d10604d5d141444519a039441bd14 /tests/pattern/classes.test.py | |
| parent | d46c40de921dd2ba62fbfcd0e2e4591eee8de2a9 (diff) | |
| download | edify-a7974d090211955c394e0fecbc547f73b7786a97.tar.xz edify-a7974d090211955c394e0fecbc547f73b7786a97.zip | |
feat: humre-style functional API — operators, constants, factories, matcher
Diffstat (limited to 'tests/pattern/classes.test.py')
| -rw-r--r-- | tests/pattern/classes.test.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/pattern/classes.test.py b/tests/pattern/classes.test.py new file mode 100644 index 0000000..de6bfc0 --- /dev/null +++ b/tests/pattern/classes.test.py @@ -0,0 +1,58 @@ +"""Tests for the module-level character-class :class:`Pattern` constants.""" + +import pytest + +from edify import ( + ANY_CHAR, + CARRIAGE_RETURN, + DIGIT, + NEW_LINE, + NON_DIGIT, + NON_WHITESPACE, + NON_WORD, + NULL_BYTE, + TAB, + WHITESPACE, + WORD, + Pattern, +) + + + ("constant", "expected"), + [ + (ANY_CHAR, "."), + (WHITESPACE, "\\s"), + (NON_WHITESPACE, "\\S"), + (DIGIT, "\\d"), + (NON_DIGIT, "\\D"), + (WORD, "\\w"), + (NON_WORD, "\\W"), + (NEW_LINE, "\\n"), + (CARRIAGE_RETURN, "\\r"), + (TAB, "\\t"), + (NULL_BYTE, "\\0"), + ], +) +def test_character_class_constant_compiles_to_expected_regex(constant, expected): + assert constant.to_regex_string() == expected + + + "constant", + [ + ANY_CHAR, + WHITESPACE, + NON_WHITESPACE, + DIGIT, + NON_DIGIT, + WORD, + NON_WORD, + NEW_LINE, + CARRIAGE_RETURN, + TAB, + NULL_BYTE, + ], +) +def test_character_class_constant_is_a_pattern(constant): + assert isinstance(constant, Pattern) |
