Parameterize tests
This commit is contained in:
parent
253e594a60
commit
151978cb1f
|
@ -1,4 +1,6 @@
|
|||
from standardize_test_format import standardize_java_text
|
||||
import pytest
|
||||
|
||||
from standardize_test_format import NamingScheme, standardize_java_text
|
||||
|
||||
INPUT_1 = """
|
||||
package test;
|
||||
|
@ -47,7 +49,7 @@ import org.junit.jupiter.api.DisplayName;
|
|||
|
||||
@Test
|
||||
@DisplayName("Hello World Test")
|
||||
public void helloWorldTest(
|
||||
public void helloWorld(
|
||||
"""
|
||||
|
||||
INPUT_4 = """
|
||||
|
@ -110,30 +112,23 @@ import org.junit.jupiter.api.DisplayName;
|
|||
public void zkBinderContextImplPropagatesLotOfFieldsDirectlyFromUnderlyingZkBinderContext()
|
||||
"""
|
||||
|
||||
|
||||
def test_1():
|
||||
assert standardize_java_text(INPUT_1.strip(), False, True) == OUTPUT_1.strip()
|
||||
JAVADOC_TO_DISPLAYNAME = [
|
||||
(INPUT_1, OUTPUT_1),
|
||||
(INPUT_2, OUTPUT_2),
|
||||
(INPUT_3, OUTPUT_3),
|
||||
(INPUT_4, OUTPUT_4),
|
||||
(INPUT_5, OUTPUT_5),
|
||||
(INPUT_5B, OUTPUT_5),
|
||||
(INPUT_5C, OUTPUT_5),
|
||||
]
|
||||
|
||||
|
||||
def test_2():
|
||||
assert standardize_java_text(INPUT_2.strip(), False, True) == OUTPUT_2.strip()
|
||||
|
||||
|
||||
def test_3():
|
||||
assert standardize_java_text(INPUT_3.strip(), False, True) == OUTPUT_3.strip()
|
||||
|
||||
|
||||
def test_4():
|
||||
assert standardize_java_text(INPUT_4.strip(), False, True) == OUTPUT_4.strip()
|
||||
|
||||
|
||||
def test_5():
|
||||
assert standardize_java_text(INPUT_5.strip(), False, True) == OUTPUT_5.strip()
|
||||
|
||||
|
||||
def test_5b():
|
||||
assert standardize_java_text(INPUT_5B.strip(), False, True) == OUTPUT_5.strip()
|
||||
|
||||
|
||||
def test_5c():
|
||||
assert standardize_java_text(INPUT_5C.strip(), False, True) == OUTPUT_5.strip()
|
||||
@pytest.mark.parametrize('inp,output', JAVADOC_TO_DISPLAYNAME)
|
||||
def test_javadoc_to_displayname(inp: str, output: str):
|
||||
converted = standardize_java_text(
|
||||
inp.strip(),
|
||||
with_javadoc=False,
|
||||
with_display_name=True,
|
||||
naming_scheme=NamingScheme.FROM_DESC,
|
||||
)
|
||||
assert converted == output.strip()
|
||||
|
|
Loading…
Reference in New Issue
Block a user