Parsing tests
This commit is contained in:
parent
d04b88b894
commit
77f0420af2
46
test/test_parsing.py
Normal file
46
test/test_parsing.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from standardize_test_format import (
|
||||
PATTERN_DISPLAY_NAME,
|
||||
PATTERN_DISPLAY_NAME_EXPRESSION,
|
||||
PATTERN_JAVADOC,
|
||||
)
|
||||
|
||||
VALID_JAVADOCS = [
|
||||
'/** Hello World */',
|
||||
'/** Hello\n * World */',
|
||||
'/**\n * Hello World\n */',
|
||||
]
|
||||
|
||||
|
||||
VALID_DISPLAY_NAME_EXPRESSIONS = [
|
||||
'"Hello"',
|
||||
' "Hello" ',
|
||||
'"Hello " + " World!"',
|
||||
]
|
||||
|
||||
|
||||
VALID_DISPLAY_NAMES = [
|
||||
'@DisplayName("test")',
|
||||
'@DisplayName( "test" )',
|
||||
'@DisplayName(\n"test"\n)',
|
||||
'@DisplayName("Hello " + " World!")',
|
||||
'@DisplayName("Hello "\n+\n" World!")',
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('text', VALID_JAVADOCS)
|
||||
def test_javadoc_parsing(text: str):
|
||||
assert re.match(PATTERN_JAVADOC, text) is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('text', VALID_DISPLAY_NAMES)
|
||||
def test_display_name_parsing(text: str):
|
||||
assert re.match(PATTERN_DISPLAY_NAME, text) is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('text', VALID_DISPLAY_NAME_EXPRESSIONS)
|
||||
def test_display_name_expressions(text: str):
|
||||
assert re.match(PATTERN_DISPLAY_NAME_EXPRESSION, text) is not None
|
Loading…
Reference in New Issue
Block a user