Adding regex tests
This commit is contained in:
parent
c51e19fea2
commit
83fa637c43
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from standardize_test_format import NamingScheme, standardize_java_text, Config
|
from standardize_test_format import NamingScheme, standardize_java_text, Config, TEST_PATTERN
|
||||||
|
|
||||||
INPUT_1 = """
|
INPUT_1 = """
|
||||||
package test;
|
package test;
|
||||||
|
@ -135,16 +135,24 @@ JAVADOC_TO_DISPLAYNAME = [
|
||||||
(INPUT_5D, OUTPUT_5),
|
(INPUT_5D, OUTPUT_5),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CONFIG = Config(
|
||||||
|
with_javadoc=False,
|
||||||
|
with_display_name=True,
|
||||||
|
only_for_javadoc = False,
|
||||||
|
only_for_display_name = False,
|
||||||
|
only_for_todo = False,
|
||||||
|
naming_scheme=NamingScheme.FROM_DESC,
|
||||||
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize(('inp','output'), JAVADOC_TO_DISPLAYNAME)
|
@pytest.mark.parametrize(('inp','output'), JAVADOC_TO_DISPLAYNAME)
|
||||||
def test_javadoc_to_displayname(inp: str, output: str):
|
def test_javadoc_to_displayname(inp: str, output: str):
|
||||||
config = Config(
|
converted = standardize_java_text(inp.strip(), CONFIG)
|
||||||
with_javadoc=False,
|
|
||||||
with_display_name=True,
|
|
||||||
only_for_javadoc = False,
|
|
||||||
only_for_display_name = False,
|
|
||||||
only_for_todo = False,
|
|
||||||
naming_scheme=NamingScheme.FROM_DESC,
|
|
||||||
)
|
|
||||||
converted = standardize_java_text(inp.strip(), config)
|
|
||||||
assert converted == output.strip()
|
assert converted == output.strip()
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(('inp','output'), JAVADOC_TO_DISPLAYNAME)
|
||||||
|
def test_match_input(inp: str, _: str):
|
||||||
|
assert TEST_PATTERN.find(inp)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(('inp','output'), JAVADOC_TO_DISPLAYNAME)
|
||||||
|
def test_match_output(_: str, output: str):
|
||||||
|
assert TEST_PATTERN.find(output)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from standardize_test_format import NamingScheme, standardize_java_text, Config
|
from standardize_test_format import NamingScheme, standardize_java_text, Config, TEST_PATTERN
|
||||||
|
|
||||||
INPUT_6 = """
|
INPUT_6 = """
|
||||||
/** Fail when uploading the wrong share */
|
/** Fail when uploading the wrong share */
|
||||||
|
@ -18,17 +18,25 @@ NAME_FROM_COMMENT = [
|
||||||
(INPUT_6, OUTPUT_6),
|
(INPUT_6, OUTPUT_6),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CONFIG = Config(
|
||||||
|
with_javadoc=True,
|
||||||
|
with_display_name=False,
|
||||||
|
only_for_javadoc = False,
|
||||||
|
only_for_display_name = False,
|
||||||
|
only_for_todo = True,
|
||||||
|
naming_scheme=NamingScheme.FROM_DESC,
|
||||||
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
||||||
def test_javadoc_to_displayname(inp: str, output: str):
|
def test_javadoc_to_displayname(inp: str, output: str):
|
||||||
config = Config(
|
converted = standardize_java_text(inp.strip(), CONFIG)
|
||||||
with_javadoc=True,
|
|
||||||
with_display_name=False,
|
|
||||||
only_for_javadoc = False,
|
|
||||||
only_for_display_name = False,
|
|
||||||
only_for_todo = True,
|
|
||||||
naming_scheme=NamingScheme.FROM_DESC,
|
|
||||||
)
|
|
||||||
converted = standardize_java_text(inp.strip(), config)
|
|
||||||
assert converted == output.strip()
|
assert converted == output.strip()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
||||||
|
def test_match_input(inp: str, _: str):
|
||||||
|
assert TEST_PATTERN.find(inp)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
||||||
|
def test_match_output(_: str, output: str):
|
||||||
|
assert TEST_PATTERN.find(output)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user