1
0
standardize_test_format/test/test_standardize.py
Jon Michael Aanes 53b8701997
Some checks failed
Run Python tests (through Pytest) / Test (push) Successful in 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Failing after 21s
Ruff
2025-02-28 09:59:52 +01:00

140 lines
3.1 KiB
Python

from standardize_test_format import standardize_java_text
INPUT_1 = """
package test;
@Test
@DisplayName("Invocations fail with callers without required permissions")
public void selectInvocationWithoutPermission() { }
"""
OUTPUT_1 = """
package test;
import org.junit.jupiter.api.DisplayName;
@Test
@DisplayName("Invocations fail with callers without required permissions")
public void invocationsFailWithCallersWithoutRequiredPermissions() { }
"""
INPUT_2 = """
package test;
/** Invocations fail with callers without required permissions. */
@Test
public void selectInvocationWithoutPermission() { }
"""
OUTPUT_2 = """
package test;
import org.junit.jupiter.api.DisplayName;
@Test
@DisplayName("Invocations fail with callers without required permissions")
public void invocationsFailWithCallersWithoutRequiredPermissions() { }
"""
INPUT_3 = """
package test;
@Test
public void helloWorldTest(
"""
OUTPUT_3 = """
package test;
import org.junit.jupiter.api.DisplayName;
@Test
@DisplayName("Hello World Test")
public void helloWorldTest(
"""
INPUT_4 = """
package test;
/**
* Concat two produces a new array with the two input arrays joined together, with no separators.
*/
@Test
public void concatTwo()
"""
OUTPUT_4 = """
package test;
import org.junit.jupiter.api.DisplayName;
@Test
@DisplayName("Concat two produces a new array with the two input arrays joined together, with no separators")
public void concatTwoProducesNewArrayWithTwoInputArraysJoinedTogetherWithNoSeparators()
"""
INPUT_5 = """
package test;
/**
* {@link ZkBinderContextImpl} propagates a lot of fields directly from the underlying {@link
* ZkBinderContext}.
*/
@Test
public void propagate()
"""
INPUT_5B = """
package test;
@Test
@DisplayName(
"ZkBinderContextImpl propagates a lot of fields directly from the underlying ZkBinderContext")
public void zkBinderContextImplPropagatesLotOfFieldsDirectlyFromTheUnderlyingZkBinderContext()
"""
INPUT_5C = """
package test;
@Test
@DisplayName(
"ZkBinderContextImpl propagates a lot of "
+ "fields directly from "
+ "the underlying ZkBinderContext"
)
public void zkBinderContextImplPropagatesLotOfFieldsDirectlyFromTheUnderlyingZkBinderContext()
"""
OUTPUT_5 = """
package test;
import org.junit.jupiter.api.DisplayName;
@Test
@DisplayName("ZkBinderContextImpl propagates a lot of fields directly from the underlying ZkBinderContext")
public void zkBinderContextImplPropagatesLotOfFieldsDirectlyFromUnderlyingZkBinderContext()
"""
def test_1():
assert standardize_java_text(INPUT_1.strip(), False, True) == OUTPUT_1.strip()
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()