-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest | ||
import re | ||
from re import Pattern | ||
|
||
from app_properties import properties | ||
|
||
|
||
@pytest.fixture | ||
def regex_class_fixt(): | ||
@properties(filename="types_cast.yml", root="regex") | ||
class RegexClass: | ||
some_pattern_var: Pattern | ||
|
||
return RegexClass | ||
|
||
|
||
def test_regex_pattern_field(regex_class_fixt): | ||
assert regex_class_fixt.some_pattern_var == re.compile(r"\w+") | ||
|
||
|
||
def test_regex_pattern_wrong_value(): | ||
with pytest.raises(ValueError): | ||
|
||
@properties(filename="types_cast.yml", root="regex") | ||
class WrongRegexClass: | ||
wrong_pattern_var: Pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters