diff options
| author | Bobby <[email protected]> | 2022-08-31 15:29:02 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-08-31 15:29:02 -0400 |
| commit | bf27c453269d2a6958cb4b96d78a2cdebcfbdf81 (patch) | |
| tree | 5f3bc134b5b102480345e4d7e2411515028d8b1f /tests | |
| parent | 0c71e132c00f872c96200599444de106f1eddfe0 (diff) | |
| download | edify-bf27c453269d2a6958cb4b96d78a2cdebcfbdf81.tar.xz edify-bf27c453269d2a6958cb4b96d78a2cdebcfbdf81.zip | |
refactor code
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_builder.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_builder.py b/tests/test_builder.py index 7b43d7c..b6f6e20 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -1,6 +1,8 @@ import re -from edify.builder import ANY, WORD, DIGIT +from edify.builder import ANY +from edify.builder import DIGIT +from edify.builder import WORD from edify.builder import AtLeast from edify.builder import AtMost from edify.builder import Escaped @@ -11,12 +13,14 @@ from edify.builder import Range from edify.builder import RegexBuilder from edify.builder import ZeroOrMore + def catch_exception(subroutine): try: subroutine() except Exception as e: return e.__class__ + def test_invalid_section_error(): assert catch_exception(lambda: RegexBuilder().add(1)) is ValueError @@ -116,6 +120,7 @@ def test_escaped_with_quantifier(): assert re.match(regex, "...") is not None assert re.match(regex, "....") is not None + def test_escaped_with_quantifier_and_optional(): regex = ( RegexBuilder() @@ -142,4 +147,3 @@ def test_email_using_builder(): ) assert re.match(regex, "[email protected]") is not None assert re.match(regex, "hello@example") is None - |
