From c51e19fea26e5d4130c8630c83ccef8683d9884d Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 15 Apr 2025 10:46:10 +0200 Subject: [PATCH] Fixing tests --- test/test_standardize.py | 14 +----------- test/test_standardize_from_todo.py | 34 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 test/test_standardize_from_todo.py diff --git a/test/test_standardize.py b/test/test_standardize.py index 5f0ef52..ba62b6c 100644 --- a/test/test_standardize.py +++ b/test/test_standardize.py @@ -124,18 +124,6 @@ import org.junit.jupiter.api.DisplayName; public void zkBinderContextImplPropagatesLotFieldsDirectlyFromUnderlyingZkBinderContext() """ -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 failWhenUploadingTheWrongShare() { -""" - JAVADOC_TO_DISPLAYNAME = [ (INPUT_1, OUTPUT_1), (INPUT_2, OUTPUT_2), @@ -145,7 +133,6 @@ JAVADOC_TO_DISPLAYNAME = [ (INPUT_5B, OUTPUT_5), (INPUT_5C, OUTPUT_5), (INPUT_5D, OUTPUT_5), - (INPUT_6, OUTPUT_6), ] @@ -156,6 +143,7 @@ def test_javadoc_to_displayname(inp: str, output: str): 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) diff --git a/test/test_standardize_from_todo.py b/test/test_standardize_from_todo.py new file mode 100644 index 0000000..76b11a2 --- /dev/null +++ b/test/test_standardize_from_todo.py @@ -0,0 +1,34 @@ +import pytest + +from standardize_test_format import NamingScheme, standardize_java_text, Config + +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 failWhenUploadingTheWrongShare() { +""" + +NAME_FROM_COMMENT = [ + (INPUT_6, OUTPUT_6), +] + + +@pytest.mark.parametrize(('inp','output'), NAME_FROM_COMMENT) +def test_javadoc_to_displayname(inp: str, output: str): + 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, + ) + converted = standardize_java_text(inp.strip(), config) + assert converted == output.strip() +