43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
import pytest
|
|
|
|
from standardize_test_format import NamingScheme, standardize_java_text, Config, TEST_PATTERN
|
|
|
|
INPUT_6 = """
|
|
/** Fail when uploading the wrong share */
|
|
@ContractTest(previous = "registerSharing")
|
|
void TODO2() {
|
|
"""
|
|
|
|
OUTPUT_6 = """
|
|
/** Fail when uploading the wrong share. */
|
|
@ContractTest(previous = "registerSharing")
|
|
void failWhenUploadingWrongShare() {
|
|
"""
|
|
|
|
NAME_FROM_COMMENT = [
|
|
(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)
|
|
def test_javadoc_to_displayname(inp: str, output: str):
|
|
converted = standardize_java_text(inp.strip(), CONFIG)
|
|
assert converted == output.strip()
|
|
|
|
|
|
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
|
def test_match_input(inp: str, output: str):
|
|
assert TEST_PATTERN.search(inp)
|
|
|
|
@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT)
|
|
def test_match_output(inp: str, output: str):
|
|
assert TEST_PATTERN.search(output)
|