From 6a9772edc143510afeafca9df3c163e8213e2b01 Mon Sep 17 00:00:00 2001 From: qth2hi Date: Fri, 12 Apr 2024 16:55:22 +0200 Subject: [PATCH 1/8] Self test maintenance: Test cases JPP_1500 and JPP_1501 retested and reworked --- test/JPP_TestUsecases.csv | 4 +- test/JPP_TestUsecases.html | 6 +- test/JPP_TestUsecases.rst | 6 +- test/JPP_TestUsecases.txt | 6 +- test/component_test.py | 4 +- .../test_16_STRING_INDICES_GOODCASE.py | 6 +- test/testconfig/TestConfig.py | 120 ++++++++++++------ test/testfiles/jpp-test_config_1500.jsonp | 46 +++---- test/testfiles/jpp-test_config_1501.jsonp | 47 +++---- 9 files changed, 136 insertions(+), 109 deletions(-) diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index aa6cf51d..32ab9147 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -126,8 +126,8 @@ JPP_1362|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (0:${ne JPP_1363|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (left hand side of colon) JPP_1364|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (left hand side of colon) JPP_1365|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (combinations with negative integer parameter) -JPP_1500|STRING_INDICES|GOODCASE|JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation) -JPP_1501|STRING_INDICES|GOODCASE|JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation) +JPP_1500|STRING_INDICES|GOODCASE|JSON file with several combinations with indices (standard notation) +JPP_1501|STRING_INDICES|GOODCASE|JSON file with several combinations with indices (dotdict notation) JPP_1650|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (1) JPP_1651|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (2) JPP_1652|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (3) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index 39d7c5bf..2e152904 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -4244,7 +4244,7 @@ -JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation)
+JSON file with several combinations with indices (standard notation)
Expected: JsonPreprocessor returns expected value @@ -4277,7 +4277,7 @@ -JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation)
+JSON file with several combinations with indices (dotdict notation)
Expected: JsonPreprocessor returns expected value @@ -4751,7 +4751,7 @@
 

-
Generated: 08.04.2024 - 14:47:37
+
Generated: 12.04.2024 - 16:42:21
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index 5b8bd426..a5fb66fc 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -1347,7 +1347,7 @@ Test Use Cases [STRING_INDICES / GOODCASE] - **JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation)** + **JSON file with several combinations with indices (standard notation)** Expected: JsonPreprocessor returns expected value @@ -1357,7 +1357,7 @@ Test Use Cases [STRING_INDICES / GOODCASE] - **JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation)** + **JSON file with several combinations with indices (dotdict notation)** Expected: JsonPreprocessor returns expected value @@ -1503,5 +1503,5 @@ Test Use Cases ---- -Generated: 08.04.2024 - 14:47:37 +Generated: 12.04.2024 - 16:42:21 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 054356ec..0b4d7690 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -554,11 +554,11 @@ Description: JSON file with blocked slicing notation (combinations with negative Expectation: No values are returned, and JsonPreprocessor throws an exception ------------------------------------------------------------------------------------------------------------------------ Test JPP_1500 / STRING_INDICES / GOODCASE -Description: JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation) +Description: JSON file with several combinations with indices (standard notation) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ Test JPP_1501 / STRING_INDICES / GOODCASE -Description: JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation) +Description: JSON file with several combinations with indices (dotdict notation) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ Test JPP_1650 / NOT_EXISTING_PARAMETERS / BADCASE @@ -617,5 +617,5 @@ Test JPP_1901 / ASSIGNMENTS_BY_REFERENCE / GOODCASE Description: JSON file with list assignments (by reference) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ -Generated: 08.04.2024 - 14:47:37 +Generated: 12.04.2024 - 16:42:21 diff --git a/test/component_test.py b/test/component_test.py index 94a285f6..de88ef4d 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,8 +22,8 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.41.0" -VERSION_DATE = "08.04.2024" +VERSION = "0.42.0" +VERSION_DATE = "12.04.2024" # # -------------------------------------------------------------------------------------------------------------- #TM*** diff --git a/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py b/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py index e4be40a9..92ca7866 100644 --- a/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py +++ b/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 08.04.2024 - 14:47:37 +# 12.04.2024 - 16:42:21 # # -------------------------------------------------------------------------------------------------------------- @@ -32,7 +32,7 @@ class Test_STRING_INDICES_GOODCASE: # -------------------------------------------------------------------------------------------------------------- # Expected: JsonPreprocessor returns expected value @pytest.mark.parametrize( - "Description", ["JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation)",] + "Description", ["JSON file with several combinations with indices (standard notation)",] ) def test_JPP_1500(self, Description): nReturn = CExecute.Execute("JPP_1500") @@ -40,7 +40,7 @@ def test_JPP_1500(self, Description): # -------------------------------------------------------------------------------------------------------------- # Expected: JsonPreprocessor returns expected value @pytest.mark.parametrize( - "Description", ["JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation)",] + "Description", ["JSON file with several combinations with indices (dotdict notation)",] ) def test_JPP_1501(self, Description): nReturn = CExecute.Execute("JPP_1501") diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index 0fb1c674..76dd8bee 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 08.04.2024 +# 12.04.2024 # # !!! Temporarily tests are deactivated by the following line commented out: # # # listofdictUsecases.append(dictUsecase) @@ -3023,68 +3023,106 @@ del dictUsecase # -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- -# -# https://github.com/test-fullautomation/python-jsonpreprocessor/issues/269 -# https://github.com/test-fullautomation/python-jsonpreprocessor/issues/253 -# dictUsecase = {} dictUsecase['TESTID'] = "JPP_1500" -dictUsecase['DESCRIPTION'] = "JSON file with indices applied to a string (inside lists and inside dictionaries; standard notation)" +dictUsecase['DESCRIPTION'] = "JSON file with several combinations with indices (standard notation)" dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" dictUsecase['SECTION'] = "STRING_INDICES" dictUsecase['SUBSECTION'] = "GOODCASE" dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None -dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1500.jsonp" # partially commented out +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1500.jsonp" # partially commented out // "param03" : ${indexList}[${indexList}[${index}]], // !!! returns STR instead of INT (also param11, k20C, k21B) !!! dictUsecase['EXPECTEDEXCEPTION'] = None dictUsecase['EXPECTEDRETURN'] = """ -[DICT] (8/1) > {stringParam} [STR] : 'ABCDE' -[DICT] (8/2) > {index} [INT] : 1 -[DICT] (8/3) > {indexList} [LIST] (3/1) > [INT] : 0 -[DICT] (8/3) > {indexList} [LIST] (3/2) > [INT] : 1 -[DICT] (8/3) > {indexList} [LIST] (3/3) > [INT] : 2 -[DICT] (8/4) > {indexDict} [DICT] (3/1) > {A} [INT] : 0 -[DICT] (8/4) > {indexDict} [DICT] (3/2) > {B} [INT] : 1 -[DICT] (8/4) > {indexDict} [DICT] (3/3) > {C} [INT] : 2 -[DICT] (8/5) > {keyList} [LIST] (3/1) > [STR] : 'A' -[DICT] (8/5) > {keyList} [LIST] (3/2) > [STR] : 'B' -[DICT] (8/5) > {keyList} [LIST] (3/3) > [STR] : 'C' -[DICT] (8/6) > {param01} [STR] : 'B' -[DICT] (8/7) > {param02} [STR] : 'B' -[DICT] (8/8) > {param04} [STR] : '1' +[DICT] (17/1) > {stringParam} [STR] : 'ABCDE' +[DICT] (17/2) > {index} [INT] : 1 +[DICT] (17/3) > {indexList} [LIST] (3/1) > [INT] : 0 +[DICT] (17/3) > {indexList} [LIST] (3/2) > [INT] : 1 +[DICT] (17/3) > {indexList} [LIST] (3/3) > [INT] : 2 +[DICT] (17/4) > {indexDict} [DICT] (3/1) > {A} [INT] : 0 +[DICT] (17/4) > {indexDict} [DICT] (3/2) > {B} [INT] : 1 +[DICT] (17/4) > {indexDict} [DICT] (3/3) > {C} [INT] : 2 +[DICT] (17/5) > {keyList} [LIST] (3/1) > [STR] : 'A' +[DICT] (17/5) > {keyList} [LIST] (3/2) > [STR] : 'B' +[DICT] (17/5) > {keyList} [LIST] (3/3) > [STR] : 'C' +[DICT] (17/6) > {param01} [STR] : 'B' +[DICT] (17/7) > {param02} [STR] : 'B' +[DICT] (17/8) > {param04} [STR] : '1' +[DICT] (17/9) > {param05} [STR] : 'B' +[DICT] (17/10) > {param06} [STR] : 'B' +[DICT] (17/11) > {param07} [STR] : 'B' +[DICT] (17/12) > {param08} [STR] : 'B' +[DICT] (17/13) > {param10} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/13) > {param10} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/14) > {param12} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/14) > {param12} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/15) > {param13} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/15) > {param13} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/1) > {k20A} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/2) > {k20B} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/3) > {k20D} [STR] : '1' +[DICT] (17/16) > {param20} [DICT] (7/4) > {k20E} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/5) > {k20F} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/6) > {k20G} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/7) > {k20H} [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/1) > {k21A} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/1) > {k21A} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/2) > {k21C} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/2) > {k21C} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/3) > {k21D} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/3) > {k21D} [LIST] (2/2) > [STR] : 'B' """ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- -# -# https://github.com/test-fullautomation/python-jsonpreprocessor/issues/268 -# dictUsecase = {} dictUsecase['TESTID'] = "JPP_1501" -dictUsecase['DESCRIPTION'] = "JSON file with indices applied to a string (inside lists and inside dictionaries; dotdict notation)" +dictUsecase['DESCRIPTION'] = "JSON file with several combinations with indices (dotdict notation)" dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" dictUsecase['SECTION'] = "STRING_INDICES" dictUsecase['SUBSECTION'] = "GOODCASE" dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None -dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1501.jsonp" # partially commented out +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1501.jsonp" # partially commented out // "param03" : ${indexList.${indexList.${index}}}, // !!! returns STR instead of INT (also param11, k20C, k21B) !!! dictUsecase['EXPECTEDEXCEPTION'] = None dictUsecase['EXPECTEDRETURN'] = """ -[DICT] (9/1) > {stringParam} [STR] : 'ABCDE' -[DICT] (9/2) > {index} [INT] : 1 -[DICT] (9/3) > {indexList} [LIST] (3/1) > [INT] : 0 -[DICT] (9/3) > {indexList} [LIST] (3/2) > [INT] : 1 -[DICT] (9/3) > {indexList} [LIST] (3/3) > [INT] : 2 -[DICT] (9/4) > {indexDict} [DICT] (3/1) > {A} [INT] : 0 -[DICT] (9/4) > {indexDict} [DICT] (3/2) > {B} [INT] : 1 -[DICT] (9/4) > {indexDict} [DICT] (3/3) > {C} [INT] : 2 -[DICT] (9/5) > {keyList} [LIST] (3/1) > [STR] : 'A' -[DICT] (9/5) > {keyList} [LIST] (3/2) > [STR] : 'B' -[DICT] (9/5) > {keyList} [LIST] (3/3) > [STR] : 'C' -[DICT] (9/6) > {param02} [STR] : 'B' -[DICT] (9/7) > {param04} [STR] : '1' -[DICT] (9/8) > {param06} [STR] : 'B' -[DICT] (9/9) > {param08} [STR] : 'B' +[DICT] (17/1) > {stringParam} [STR] : 'ABCDE' +[DICT] (17/2) > {index} [INT] : 1 +[DICT] (17/3) > {indexList} [LIST] (3/1) > [INT] : 0 +[DICT] (17/3) > {indexList} [LIST] (3/2) > [INT] : 1 +[DICT] (17/3) > {indexList} [LIST] (3/3) > [INT] : 2 +[DICT] (17/4) > {indexDict} [DICT] (3/1) > {A} [INT] : 0 +[DICT] (17/4) > {indexDict} [DICT] (3/2) > {B} [INT] : 1 +[DICT] (17/4) > {indexDict} [DICT] (3/3) > {C} [INT] : 2 +[DICT] (17/5) > {keyList} [LIST] (3/1) > [STR] : 'A' +[DICT] (17/5) > {keyList} [LIST] (3/2) > [STR] : 'B' +[DICT] (17/5) > {keyList} [LIST] (3/3) > [STR] : 'C' +[DICT] (17/6) > {param01} [STR] : 'B' +[DICT] (17/7) > {param02} [STR] : 'B' +[DICT] (17/8) > {param04} [STR] : '1' +[DICT] (17/9) > {param05} [STR] : 'B' +[DICT] (17/10) > {param06} [STR] : 'B' +[DICT] (17/11) > {param07} [STR] : 'B' +[DICT] (17/12) > {param08} [STR] : 'B' +[DICT] (17/13) > {param10} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/13) > {param10} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/14) > {param12} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/14) > {param12} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/15) > {param13} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/15) > {param13} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/1) > {k20A} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/2) > {k20B} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/3) > {k20D} [STR] : '1' +[DICT] (17/16) > {param20} [DICT] (7/4) > {k20E} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/5) > {k20F} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/6) > {k20G} [STR] : 'B' +[DICT] (17/16) > {param20} [DICT] (7/7) > {k20H} [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/1) > {k21A} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/1) > {k21A} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/2) > {k21C} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/2) > {k21C} [LIST] (2/2) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/3) > {k21D} [LIST] (2/1) > [STR] : 'B' +[DICT] (17/17) > {param21} [DICT] (3/3) > {k21D} [LIST] (2/2) > [STR] : 'B' """ listofdictUsecases.append(dictUsecase) del dictUsecase diff --git a/test/testfiles/jpp-test_config_1500.jsonp b/test/testfiles/jpp-test_config_1500.jsonp index 2bd5e94f..44c80f2b 100644 --- a/test/testfiles/jpp-test_config_1500.jsonp +++ b/test/testfiles/jpp-test_config_1500.jsonp @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. //************************************************************************** - -// https://github.com/test-fullautomation/python-jsonpreprocessor/issues/269 -// https://github.com/test-fullautomation/python-jsonpreprocessor/issues/253 - { "stringParam" : "ABCDE", // @@ -27,38 +23,36 @@ "param01" : ${stringParam}[${index}], "param02" : "${stringParam}[${index}]", // - // "param03" : ${indexList}[${indexList}[${index}]], // returns STR instead of INT - "param04" : "${indexList}[${indexList}[${index}]]" - // - // --> several errors (invalid param, missing delimiter): + // "param03" : ${indexList}[${indexList}[${index}]], // !!! returns STR instead of INT (also param11, k20C, k21B) !!! + "param04" : "${indexList}[${indexList}[${index}]]", // - // "param05" : ${stringParam}[${indexList}[${indexList}[${index}]], - // "param06" : "${stringParam}[${indexList}[${indexList}[${index}]]", + "param05" : ${stringParam}[${indexList}[${indexList}[${index}]]], + "param06" : "${stringParam}[${indexList}[${indexList}[${index}]]]", // - // "param07" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], - // "param08" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]", + "param07" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], + "param08" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]", // // the same within lists - // "param10" : [${stringParam}[${index}], "${stringParam}[${index}]"], - // "param11" : [${indexList}[${indexList}[${index}]]], "${indexList}[${indexList}[${index}]]"], - // "param12" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], - // "param13" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"], + "param10" : [${stringParam}[${index}], "${stringParam}[${index}]"], + // "param11" : [${indexList}[${indexList}[${index}]], "${indexList}[${indexList}[${index}]]"], + "param12" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], + "param13" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"], // // the same within dictionaries - // "param20" : {"k20A" : ${stringParam}[${index}], - // "k20B" : "${stringParam}[${index}]", + "param20" : {"k20A" : ${stringParam}[${index}], + "k20B" : "${stringParam}[${index}]", // "k20C" : ${indexList}[${indexList}[${index}]], - // "k20D" : "${indexList}[${indexList}[${index}]]", - // "k20E" : ${stringParam}[${indexList}[${indexList}[${index}]]], - // "k20F" : "${stringParam}[${indexList}[${indexList}[${index}]]]", - // "k20G" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], - // "k20H" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"} + "k20D" : "${indexList}[${indexList}[${index}]]", + "k20E" : ${stringParam}[${indexList}[${indexList}[${index}]]], + "k20F" : "${stringParam}[${indexList}[${indexList}[${index}]]]", + "k20G" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], + "k20H" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"}, // // the same with lists as dictionay key values - // "param21" : {"k21A" : [${stringParam}[${index}], "${stringParam}[${index}]"], + "param21" : {"k21A" : [${stringParam}[${index}], "${stringParam}[${index}]"], // "k21B" : [${indexList}[${indexList}[${index}]], "${indexList}[${indexList}[${index}]]"], - // "k21C" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], - // "k21D" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"]} + "k21C" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], + "k21D" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"]} } diff --git a/test/testfiles/jpp-test_config_1501.jsonp b/test/testfiles/jpp-test_config_1501.jsonp index 318603c8..da6bc781 100644 --- a/test/testfiles/jpp-test_config_1501.jsonp +++ b/test/testfiles/jpp-test_config_1501.jsonp @@ -12,11 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. //************************************************************************** -// -// https://github.com/test-fullautomation/python-jsonpreprocessor/issues/268 -// -// All combinations should be valid. Combinations with quotes work, combinations without quotes throw errors. -// { "stringParam" : "ABCDE", // @@ -25,37 +20,37 @@ "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, "keyList" : ["A", "B", "C"], // - // "param01" : ${stringParam.${index}}, // 'Invalid expression found: '${stringParam.${index}}'.'! - "param02" : "${stringParam.${index}}", // {param02} [STR] : 'B' (like expected) + "param01" : ${stringParam.${index}}, + "param02" : "${stringParam.${index}}", // - // "param03" : ${indexList.${indexList.${index}}}, // Expecting value: line 7 column 16 (char 179)'! / reference: ${stringParam}[${indexList}[${index}]] - "param04" : "${indexList.${indexList.${index}}}", // {param03} [STR] : '1' (like expected) + // "param03" : ${indexList.${indexList.${index}}}, // !!! returns STR instead of INT (also param11, k20C, k21B) !!! + "param04" : "${indexList.${indexList.${index}}}", // - // "param05" : ${stringParam.${indexList.${indexList.${index}}}}, // Expecting value: line 7 column 16 (char 179)'! - "param06" : "${stringParam.${indexList.${indexList.${index}}}}", // {param05} [STR] : 'B' (like expected) + "param05" : ${stringParam.${indexList.${indexList.${index}}}}, + "param06" : "${stringParam.${indexList.${indexList.${index}}}}", // - // "param07" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, // Expecting value: line 7 column 16 (char 179)'! - "param08" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}" // {param07} [STR] : 'B' (like expected) + "param07" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, + "param08" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}", // // the same within lists - // "param10" : [${stringParam.${index}}, "${stringParam.${index}}"], + "param10" : [${stringParam.${index}}, "${stringParam.${index}}"], // "param11" : [${indexList.${indexList.${index}}}, "${indexList.${indexList.${index}}}"], - // "param12" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], - // "param13" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"], + "param12" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], + "param13" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"], // // the same within dictionaries - // "param20" : {"k20A" : ${stringParam.${index}}, - // "k20B" : "${stringParam.${index}}", + "param20" : {"k20A" : ${stringParam.${index}}, + "k20B" : "${stringParam.${index}}", // "k20C" : ${indexList.${indexList.${index}}}, - // "k20D" : "${indexList.${indexList.${index}}}", - // "k20E" : ${stringParam.${indexList.${indexList.${index}}}}, - // "k20F" : "${stringParam.${indexList.${indexList.${index}}}}", - // "k20G" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, - // "k20H" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"}, + "k20D" : "${indexList.${indexList.${index}}}", + "k20E" : ${stringParam.${indexList.${indexList.${index}}}}, + "k20F" : "${stringParam.${indexList.${indexList.${index}}}}", + "k20G" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, + "k20H" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"}, // // the same with lists as dictionay key values - // "param21" : {"k21A" : [${stringParam.${index}}, "${stringParam.${index}}"], + "param21" : {"k21A" : [${stringParam.${index}}, "${stringParam.${index}}"], // "k21B" : [${indexList.${indexList.${index}}}, "${indexList.${indexList.${index}}}"], - // "k21C" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], - // "k21D" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"]} + "k21C" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], + "k21D" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"]} } From 60a55a5c376e5a3196e3611f4c9cb1e165c24361 Mon Sep 17 00:00:00 2001 From: qth2hi Date: Fri, 12 Apr 2024 16:59:15 +0200 Subject: [PATCH 2/8] Code snippet generator extended --- test/testtools/GenSnippetsJPP.py | 544 +++++++++++++++++++++++++++++-- 1 file changed, 515 insertions(+), 29 deletions(-) diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index 35fe54dd..9466db17 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,8 +22,8 @@ # # ************************************************************************************************************** # -VERSION = "0.22.0" -VERSION_DATE = "27.03.2024" +VERSION = "0.23.0" +VERSION_DATE = "12.04.2024" # # ************************************************************************************************************** @@ -575,7 +575,7 @@ class CHTMLPattern(): """ sHTMLLink = """ -

+

###TEXT### @@ -1361,31 +1361,6 @@ def GetSeveralParticularSnippets(self): // Error: 'Invalid expression while handling the parameter '[${listParam}[${index}]'.'! "param9" : [${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]] } -""") - - listCodeSnippets.append("""{ - "stringParam" : "ABCDE", - // - "index" : 1, - "indexList" : [0,1,2], - "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, - "keyList" : ["A", "B", "C"], - // - "param01" : ${stringParam}[${index}], - "param02" : ${stringParam}[${indexList}[${index}]], - "param03" : ${stringParam}[${indexList}[${indexList}[${index}]]], - "param04" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], - // - "param05" : [${stringParam}[${index}], "D"], - "param06" : [${stringParam}[${indexList}[${index}]], "D"], - "param07" : [${stringParam}[${indexList}[${indexList}[${index}]]], "D"], - "param08" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "D"], - // - "param09" : {"kA" : ${stringParam}[${index}]}, - "param10" : {"kA" : [${stringParam}[${index}], "D"]}, - "param11" : {"kA" : [${stringParam}[${indexList}[${index}]], "D"]}, - "param12" : {"kA" : [${stringParam}[${indexList}[${indexList}[${index}]]], "D"]} -} """) listCodeSnippets.append("""{ @@ -1423,6 +1398,517 @@ def GetSeveralParticularSnippets(self): } """) + # some snippets that caused performance issues + + listCodeSnippets.append("""{ + "params" : {"global" : "teststring/1" : "teststring/1 value", + ${params.global.teststring/1} : "${params.global.teststring/1} extended"} +} +""") + + listCodeSnippets.append("""{ + "params" : {"global" : "list_param" : ["A", "B", "C"], + "val2" : "${params.global.list_param[1]}"} +} +""") + + listCodeSnippets.append("""{ + "params" : {"global" : "dict_param" : {"A" : 1 , "B" : 2}, + "list_param" : ["A", "B", "C"], + "val3" : "${params.global.list_param[${params.global.dict_param}['A']]}"} +} +""") + + listCodeSnippets.append("""{ + "params" : {"global" : "dict_param" : {"A" : 1 , "B" : 2}, + "list_param" : ["A", "B", "C"], + "val4" : "${params.global.list_param[${params.global.dict_param}[${params.global.list_param}[0]]]}"} +} +""") + + listCodeSnippets.append("""{ + "params" : {"global" : "dict_param" : {"A" : 1 , "B" : 2}, + "list_param" : ["A", "B", "C"], + "val5" : "${params.global.list_param[${params.global.dict_param}['${params.global.list_param}[0]']]}"} +} +""") + + listCodeSnippets.append("""{ + "params" : {"global" : "teststring*1" : "teststring*1 value", + ${params.global.teststring*1} : "${params.global.teststring*1} extended"} +} +""") + + # some snippets with special characters + + listCodeSnippets.append("""{ + "param" : {"key" : "${+}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${-}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${*}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${/}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${\\}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${&}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${$}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${%}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${#}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${~}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${?}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${ß}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${'}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${´}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${`}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${!}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${€}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${𠼭}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${{}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${}}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${[}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${]}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${(}"} +} +""") + + listCodeSnippets.append("""{ + "param" : {"key" : "${)}"} +} +""") + + listCodeSnippets.append("""{ + "+" : 1, + "param" : ${+} +} +""") + + listCodeSnippets.append("""{ + "-" : 2, + "param" : ${-} +} +""") + + listCodeSnippets.append("""{ + "*" : 3, + "param" : ${*} +} +""") + + listCodeSnippets.append("""{ + "/" : 4, + "param" : ${/} +} +""") + + listCodeSnippets.append("""{ + "\\" : 5, + "param" : ${\\} +} +""") + + listCodeSnippets.append("""{ + "&" : 6, + "param" : ${&} +} +""") + + listCodeSnippets.append("""{ + "$" : 7, + "param" : ${$} +} +""") + + listCodeSnippets.append("""{ + "%" : 8, + "param" : ${%} +} +""") + + listCodeSnippets.append("""{ + "#" : 9, + "param" : ${#} +} +""") + + listCodeSnippets.append("""{ + "~" : 10, + "param" : ${~} +} +""") + + listCodeSnippets.append("""{ + "?" : 11, + "param" : ${?} +} +""") + + listCodeSnippets.append("""{ + "ß" : 12, + "param" : ${ß} +} +""") + + listCodeSnippets.append("""{ + "'" : 13, + "param" : ${'} +} +""") + + listCodeSnippets.append("""{ + "´" : 14, + "param" : ${´} +} +""") + + listCodeSnippets.append("""{ + "`" : 15, + "param" : ${`} +} +""") + + listCodeSnippets.append("""{ + "!" : 16, + "param" : ${!} +} +""") + + listCodeSnippets.append("""{ + "€" : 17, + "param" : ${€} +} +""") + + listCodeSnippets.append("""{ + "𠼭" : 18, + "param" : ${𠼭} +} +""") + + listCodeSnippets.append("""{ + "{" : 19, + "param" : ${{} +} +""") + + listCodeSnippets.append("""{ + "}" : 20, + "param" : ${}} +} +""") + + listCodeSnippets.append("""{ + "[" : 21, + "param" : ${[} +} +""") + + listCodeSnippets.append("""{ + "]" : 22, + "param" : ${]} +} +""") + + listCodeSnippets.append("""{ + "(" : 23, + "param" : ${(} +} +""") + + listCodeSnippets.append("""{ + ")" : 24, + "param" : ${)} +} +""") + + listCodeSnippets.append("""{ + "param\\1" : "value" +} +""") + + listCodeSnippets.append("""{ + "param\\C" : "value" +} +""") + + listCodeSnippets.append("""{ + "param\n" : "value" +} +""") + + listCodeSnippets.append("""{ + "param\\n" : "value" +} +""") + + listCodeSnippets.append("""{ + "param\t" : "value" +} +""") + + listCodeSnippets.append("""{ + "param\\t" : "value" +} +""") + + # several combinations with indices + # (to be updated in official self test when feature runs stable) + # > python-jsonpreprocessor\test\testfiles\jpp-test_config_1500.jsonp + # > python-jsonpreprocessor\test\testfiles\jpp-test_config_1501.jsonp + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-1", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param01" : ${stringParam}[${index}], + "param02" : "${stringParam}[${index}]", + // + "param03" : ${indexList}[${indexList}[${index}]], // returns STR instead of INT + "param04" : "${indexList}[${indexList}[${index}]]", + // + "param05" : ${stringParam}[${indexList}[${indexList}[${index}]]], + "param06" : "${stringParam}[${indexList}[${indexList}[${index}]]]", + // + "param07" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], + "param08" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]" +} +""") + + # the same like above, but within lists + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-2", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param10" : [${stringParam}[${index}], "${stringParam}[${index}]"], + "param11" : [${indexList}[${indexList}[${index}]], "${indexList}[${indexList}[${index}]]"], + "param12" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], + "param13" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"] +} +""") + + # the same like above, but within dictionaries + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-3", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param20" : {"k20A" : ${stringParam}[${index}], + "k20B" : "${stringParam}[${index}]", + "k20C" : ${indexList}[${indexList}[${index}]], + "k20D" : "${indexList}[${indexList}[${index}]]", + "k20E" : ${stringParam}[${indexList}[${indexList}[${index}]]], + "k20F" : "${stringParam}[${indexList}[${indexList}[${index}]]]", + "k20G" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], + "k20H" : "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"} +} +""") + + # the same like above, but with lists as dictionary key values + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-4", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param21" : {"k21A" : [${stringParam}[${index}], "${stringParam}[${index}]"], + "k21B" : [${indexList}[${indexList}[${index}]], "${indexList}[${indexList}[${index}]]"], + "k21C" : [${stringParam}[${indexList}[${indexList}[${index}]]], "${stringParam}[${indexList}[${indexList}[${index}]]]"], + "k21D" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]]"]} +} +""") + + + # several combinations with indices + # (to be updated in official self test when feature runs stable) + # > python-jsonpreprocessor\test\testfiles\jpp-test_config_1500.jsonp + # > python-jsonpreprocessor\test\testfiles\jpp-test_config_1501.jsonp + + # all the same like above, but in dotdict notation + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-5", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param01" : ${stringParam.${index}}, + "param02" : "${stringParam.${index}}", + // + "param03" : ${indexList.${indexList.${index}}}, + "param04" : "${indexList.${indexList.${index}}}", + // + "param05" : ${stringParam.${indexList.${indexList.${index}}}}, + "param06" : "${stringParam.${indexList.${indexList.${index}}}}", + // + "param07" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, + "param08" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}" +} +""") + + # the same like above, but within lists + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-6", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param10" : [${stringParam.${index}}, "${stringParam.${index}}"], + "param11" : [${indexList.${indexList.${index}}}, "${indexList.${indexList.${index}}}"], + "param12" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], + "param13" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"] +} +""") + + # the same like above, but within dictionaries + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-7", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param20" : {"k20A" : ${stringParam.${index}}, + "k20B" : "${stringParam.${index}}", + "k20C" : ${indexList.${indexList.${index}}}, + "k20D" : "${indexList.${indexList.${index}}}", + "k20E" : ${stringParam.${indexList.${indexList.${index}}}}, + "k20F" : "${stringParam.${indexList.${indexList.${index}}}}", + "k20G" : ${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, + "k20H" : "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"} +} +""") + + # the same like above, but with lists as dictionary key values + + listCodeSnippets.append("""{ + "stringParam" : "ABCDE-8", + // + "index" : 1, + "indexList" : [0,1,2], + "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, + "keyList" : ["A", "B", "C"], + // + "param21" : {"k21A" : [${stringParam.${index}}, "${stringParam.${index}}"], + "k21B" : [${indexList.${indexList.${index}}}, "${indexList.${indexList.${index}}}"], + "k21C" : [${stringParam.${indexList.${indexList.${index}}}}, "${stringParam.${indexList.${indexList.${index}}}}"], + "k21D" : [${stringParam.${indexDict.${keyList.${indexList.${index}}}}}, "${stringParam.${indexDict.${keyList.${indexList.${index}}}}}"]} +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param" : [${indexList}[${index}], [${indexList}[${index}], ${indexList}[${index}]], ${indexList}[${index}]] +} +""") + # listCodeSnippets.append("""{ # } @@ -2276,7 +2762,7 @@ def GetSpacesAndLineBreaks(self): sDefinitions = """ "index" : 0, "listParam" : [0,1,2], "value" : "A", - "dictParam" : {"A" : 1, "B" : 2} + "dictParam" : {"A" : 1, "B" : 2}, """ sCodeSnippetPattern = """{ From 130cd230d36fca49a91aa7413e0bf64910faee0a Mon Sep 17 00:00:00 2001 From: qth2hi Date: Mon, 15 Apr 2024 17:05:32 +0200 Subject: [PATCH 3/8] Code snippet generator extended (usage of internal token strings) --- test/testtools/GenSnippetsJPP.py | 164 ++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 2 deletions(-) diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index 9466db17..9c0b51e8 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,8 +22,8 @@ # # ************************************************************************************************************** # -VERSION = "0.23.0" -VERSION_DATE = "12.04.2024" +VERSION = "0.24.0" +VERSION_DATE = "15.04.2024" # # ************************************************************************************************************** @@ -1909,6 +1909,58 @@ def GetSeveralParticularSnippets(self): } """) + # combinations with internal token strings + + listCodeSnippets.append("""{ + "testlist" : ["A", "B", "C", "D"], + "__SlicingIndex__" : 1, + "param" : ${testlist}[0:${__SlicingIndex__}] +} +""") + + listCodeSnippets.append("""{ + "testlist" : ["A", "B", "C", "D"], + "__IndexOfList__" : 1, + "param" : ${testlist}[${__IndexOfList__}] +} +""") + + listCodeSnippets.append("""{ + "__ConvertParameterToString__" : 1 +} +""") + + listCodeSnippets.append("""{ + "__ConvertParameterToString__" : 1, + "param" : "${__ConvertParameterToString__}" +} +""") + + listCodeSnippets.append("""{ + "__handleColonsInLine__" : 1, + "param" : "${__handleColonsInLine__} : ${__handleColonsInLine__}" +} +""") + + listCodeSnippets.append("""{ + "__handleDuplicatedKey__00" : 1 +} +""") + + listCodeSnippets.append("""{ + "__handleDuplicatedKey__00--A" : 1 +} +""") + + listCodeSnippets.append("""{ + "testdict" : {"__handleDuplicatedKey__00" : 1, "__handleDuplicatedKey__00" : 2} +} +""") + + listCodeSnippets.append("""{ + "testdict" : {"__handleDuplicatedKey__00--A" : 1, "__handleDuplicatedKey__00--B" : 2} +} +""") # listCodeSnippets.append("""{ # } @@ -2815,6 +2867,111 @@ def GetSpacesAndLineBreaks(self): # -------------------------------------------------------------------------------------------------------------- + def GetInternalTokenStrings(self): + """Several snippets containing JsonPreprocessor internal token strings + """ + + sHeadline = "Several snippets containing JsonPreprocessor internal token strings" + + listDataStructures =[] + + sDataStructure = """ "*01*" : 1 +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "prefix_*01*_suffix" : 2 +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "*01*" : 3, + "param1" : ${*01*} +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "*01*" : 4, + "param2" : "${*01*}" +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "testlist" : [0,1,2,3,4,5,6,7,8,9], + "*01*" : 5, + "param3" : ${testlist}[${*01*}] +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "testlist" : [0,1,2,3,4,5,6,7,8,9], + "*01*" : 6, + "param4" : "${testlist}[${*01*}]" +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "*01*" : 7, + "param5" : "${*01*} : ${*01*}" +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "testlist" : [0,1,2,3,4,5,6,7,8,9], + "*01*" : 8, + "param6" : ${testlist}[0:${*01*}] +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "testdict1" : {"*01*" : 1, "*01*" : 2} +""" + listDataStructures.append(sDataStructure) + + sDataStructure = """ "testdict2" : {"prefix_*01*_suffix" : 1, "prefix_*01*_suffix" : 2} +""" + listDataStructures.append(sDataStructure) + + sCodeSnippetPattern = """{ +####DATASTRUCTURE####} +""" + + # We have a list of expressions and we have a list of placeholders like used in sDataStructure1. + # The followig code runs in a nested loop: Every expression is placed at every placeholder position. Only one single + # expression and placeholder per iteration. All remaining placeholders in current iteration are replaced by elements + # from a list of filler expressions (simple letters) that are only used to complete the code snippet, but are not in focus. + + listExpressions = ["__handleColonsInLine__","__handleDuplicatedKey__00","__handleDuplicatedKey__","__ConvertParameterToString__", + "__IndexOfList__","__SlicingIndex__","__StringValueMake-up__"] + + listPlaceholders = ["*01*",] + + listPositions = listPlaceholders[:] # to support a nested iteration of the same list; better readibility of code because of different names + + listFiller = ["F01",] # as much elements as in listPlaceholders + + # put all things together + + listCodeSnippets = [] + + # sDataStructure1 + + for sExpression in listExpressions: + for sPosition in listPositions: + for sDataStructure in listDataStructures: # init a new data structure from pattern sDataStructure1 + sCodeSnippet = sCodeSnippetPattern # init a new code snippet from code snippet pattern + oFiller = CListElements(listFiller) # init a new filler object (= content for remaining placeholders) + for sPlaceholder in listPlaceholders: + sFiller = oFiller.GetElement() + if sPosition == sPlaceholder: + sDataStructure = sDataStructure.replace(sPlaceholder, sExpression) + else: + sDataStructure = sDataStructure.replace(sPlaceholder, f"{sFiller}") + # eof for sPlaceholder in listPlaceholders: + sCodeSnippet = sCodeSnippet.replace("####DATASTRUCTURE####", sDataStructure) + listCodeSnippets.append(sCodeSnippet) + # eof for sDataStructure in listDataStructures: + # eof for sPosition in listPositions: + # eof for sExpression in listExpressions: + + return sHeadline, listCodeSnippets + + # eof def GetInternalTokenStrings(self): + + # -------------------------------------------------------------------------------------------------------------- + # eof class CSnippets(): # -------------------------------------------------------------------------------------------------------------- @@ -2959,6 +3116,9 @@ def GetSpacesAndLineBreaks(self): sHeadline, listCodeSnippets = oSnippets.GetSpacesAndLineBreaks() bSuccess, sResult = oExecutor.Execute(sHeadline, listCodeSnippets, "JPP") +sHeadline, listCodeSnippets = oSnippets.GetInternalTokenStrings() +bSuccess, sResult = oExecutor.Execute(sHeadline, listCodeSnippets, "JPP") + print() print(COLBG + "done") print() From c1eb94a681808c1c332be96e0fb26e33ba2dfc24 Mon Sep 17 00:00:00 2001 From: qth2hi Date: Tue, 16 Apr 2024 16:36:29 +0200 Subject: [PATCH 4/8] Code snippet generator extended (additional brackets and spaces) --- test/testtools/GenSnippetsJPP.py | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index 9c0b51e8..de720083 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,8 +22,8 @@ # # ************************************************************************************************************** # -VERSION = "0.24.0" -VERSION_DATE = "15.04.2024" +VERSION = "0.25.0" +VERSION_DATE = "16.04.2024" # # ************************************************************************************************************** @@ -1960,6 +1960,50 @@ def GetSeveralParticularSnippets(self): listCodeSnippets.append("""{ "testdict" : {"__handleDuplicatedKey__00--A" : 1, "__handleDuplicatedKey__00--B" : 2} } +""") + + # additional brackets and spaces + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param1" : ${indexList}[${indexList}[[${index}]] +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param2" : "${indexList}[${indexList}[[${index}]]" +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param3" : "${indexList} [${indexList}[${index}]]" +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param4" : "${indexList}[${indexList} [${index}]]" +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param5" : " ${indexList} [ ${indexList} [ ${index} ] ] " +} +""") + + listCodeSnippets.append("""{ + "index" : 1, + "indexList" : [0,1,2], + "param6" : "${ indexList }[${indexList}[${index}]]" +} """) # listCodeSnippets.append("""{ From 76cb500524a9283bf2d53c083524ff322a9eef98 Mon Sep 17 00:00:00 2001 From: qth2hi Date: Wed, 17 Apr 2024 10:28:02 +0200 Subject: [PATCH 5/8] Self test adaptions w.r.t. latest bug fixes * JPP_1003 updated * Code snippet generator updated --- test/component_test.py | 4 ++-- test/testconfig/TestConfig.py | 21 +++++++++++---------- test/testfiles/jpp-test_config_1003.jsonp | 8 +++----- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/test/component_test.py b/test/component_test.py index de88ef4d..30ff6f03 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,8 +22,8 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.42.0" -VERSION_DATE = "12.04.2024" +VERSION = "0.43.0" +VERSION_DATE = "17.04.2024" # # -------------------------------------------------------------------------------------------------------------- #TM*** diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index 76dd8bee..4b880e60 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 12.04.2024 +# 17.04.2024 # # !!! Temporarily tests are deactivated by the following line commented out: # # # listofdictUsecases.append(dictUsecase) @@ -2579,7 +2579,6 @@ del dictUsecase # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} -# ====== still one line in jpp-test_config_1003.jsonp commented out; remaining code run properly dictUsecase['TESTID'] = "JPP_1003" dictUsecase['DESCRIPTION'] = "JSON file with combinations of implicit and explicit creation / access to implicitly created keys by parameters / dict assignment by reference" dictUsecase['EXPECTATION'] = "JsonPreprocessor returns values" @@ -2590,14 +2589,16 @@ dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1003.jsonp" dictUsecase['EXPECTEDEXCEPTION'] = None dictUsecase['EXPECTEDRETURN'] = """ -[DICT] (8/1) > {testdict2} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 3 -[DICT] (8/2) > {param1} [STR] : 'subKey1' -[DICT] (8/3) > {param2} [STR] : 'subKey2' -[DICT] (8/4) > {param3} [STR] : 'subKey3' -[DICT] (8/5) > {param4} [STR] : 'subKey4' -[DICT] (8/6) > {param5} [INT] : 3 -[DICT] (8/7) > {param7} [STR] : '3' -[DICT] (8/8) > {testdict1} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 3 +[DICT] (10/1) > {testdict2} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 3 +[DICT] (10/2) > {param1} [STR] : 'subKey1' +[DICT] (10/3) > {param2} [STR] : 'subKey2' +[DICT] (10/4) > {param3} [STR] : 'subKey3' +[DICT] (10/5) > {param4} [STR] : 'subKey4' +[DICT] (10/6) > {param5} [INT] : 3 +[DICT] (10/7) > {param6} [STR] : '3' +[DICT] (10/8) > {param7} [INT] : 3 +[DICT] (10/9) > {param8} [STR] : '3' +[DICT] (10/10) > {testdict1} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 3 """ listofdictUsecases.append(dictUsecase) del dictUsecase diff --git a/test/testfiles/jpp-test_config_1003.jsonp b/test/testfiles/jpp-test_config_1003.jsonp index df5a0cb2..e9f33204 100644 --- a/test/testfiles/jpp-test_config_1003.jsonp +++ b/test/testfiles/jpp-test_config_1003.jsonp @@ -30,9 +30,7 @@ ${testdict2.${param1}.subKey2.${param3}.subKey4} : 3, // assign modified values to new parameters "param5" : ${testdict1}[${param1}]['${param2}']['subKey3'][${param4}], - - // still issue: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/232 - // "param6" : ${testdict2.${param1}.subKey2.${param3}.subKey4} // Expecting value: line 11 column 15 (char 412)'! - "param7" : "${testdict2.${param1}.subKey2.${param3}.subKey4}" + "param6" : "${testdict1}[${param1}]['${param2}']['subKey3'][${param4}]", + "param7" : ${testdict2.${param1}.subKey2.${param3}.subKey4}, + "param8" : "${testdict2.${param1}.subKey2.${param3}.subKey4}" } - From 9bcdd44f137041a7f88bb4993cb1d8af8864d51b Mon Sep 17 00:00:00 2001 From: qth2hi Date: Wed, 17 Apr 2024 11:58:14 +0200 Subject: [PATCH 6/8] Self test maintenance w.r.t. latest bug fixes --- test/testfiles/jpp-test_config_1400.jsonp | 15 +++++------ test/testtools/GenSnippetsJPP.py | 32 +++++++++++------------ 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/test/testfiles/jpp-test_config_1400.jsonp b/test/testfiles/jpp-test_config_1400.jsonp index 662c3cbc..ee7c89e6 100644 --- a/test/testfiles/jpp-test_config_1400.jsonp +++ b/test/testfiles/jpp-test_config_1400.jsonp @@ -19,16 +19,13 @@ "param1" : [${index}, "A"], "param2" : [${listParam}[${index}], "A"], // - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/253 + "param3" : [[${listParam}[${index}], "A"], "B"], + "param4" : [["A", ${listParam}[${index}]], "B"], // - "param3" : [[${listParam}[${index}], "A"], "B"], // Expecting ':' delimiter: line ... - "param4" : [["A", ${listParam}[${index}]], "B"], // Expecting ',' delimiter: line ... + "param5" : ["B", [${listParam}[${index}], "A"]], + "param6" : ["B", ["A", ${listParam}[${index}]]], + "param7" : ["B", [${listParam}[${index}], "A"], "C"], + "param8" : ["B", ["A", ${listParam}[${index}]], "C"], // - "param5" : ["B", [${listParam}[${index}], "A"]], // Expecting ',' delimiter: line ... - "param6" : ["B", ["A", ${listParam}[${index}]]], // Expecting ',' delimiter: line ... - "param7" : ["B", [${listParam}[${index}], "A"], "C"], // Expecting ':' delimiter: line ... - "param8" : ["B", ["A", ${listParam}[${index}]], "C"], // Expecting ',' delimiter: line ... - // - // Error: 'Invalid expression while handling the parameter '[${listParam}[${index}]'.'! "param9" : [${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]] } diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index de720083..0d9a7da3 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,8 +22,8 @@ # # ************************************************************************************************************** # -VERSION = "0.25.0" -VERSION_DATE = "16.04.2024" +VERSION = "0.26.1" +VERSION_DATE = "17.04.2024" # # ************************************************************************************************************** @@ -850,8 +850,9 @@ def GetSeveralParticularSnippets(self): ${testdict2.${param1}.subKey2.${param3}.subKey4} : 3, // assign modified values to new parameters "param5" : ${testdict1}[${param1}]['${param2}']['subKey3'][${param4}], - // still issue: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/232 - "param6" : ${testdict2.${param1}.subKey2.${param3}.subKey4} // Expecting value: line 11 column 15 (char 412)'! + "param6" : "${testdict1}[${param1}]['${param2}']['subKey3'][${param4}]", + "param7" : ${testdict2.${param1}.subKey2.${param3}.subKey4}, + "param8" : "${testdict2.${param1}.subKey2.${param3}.subKey4}" } """) @@ -1161,7 +1162,6 @@ def GetSeveralParticularSnippets(self): """) listCodeSnippets.append("""{ - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [[[${listP}[${IAMNOTEXISTING}], 123], ${listP}[${IAMNOTEXISTING}]], ${listP}[${IAMNOTEXISTING}]] } @@ -1175,8 +1175,8 @@ def GetSeveralParticularSnippets(self): """) listCodeSnippets.append("""{ -${testdict.subKey.subKey.subKey} : {"A" : 1}, -"testdict": {"subKey": {"subKey": {"subKey": {"A": 2}}}} + ${testdict.subKey.subKey.subKey} : {"A" : 1}, + "testdict": {"subKey": {"subKey": {"subKey": {"A": 2}}}} } """) @@ -1348,23 +1348,21 @@ def GetSeveralParticularSnippets(self): "param1" : [${index}, "A"], "param2" : [${listParam}[${index}], "A"], // - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/253 + "param3" : [[${listParam}[${index}], "A"], "B"], + "param4" : [["A", ${listParam}[${index}]], "B"], // - "param3" : [[${listParam}[${index}], "A"], "B"], // Expecting ':' delimiter: line ... - "param4" : [["A", ${listParam}[${index}]], "B"], // Expecting ',' delimiter: line ... + "param5" : ["B", [${listParam}[${index}], "A"]], + "param6" : ["B", ["A", ${listParam}[${index}]]], + "param7" : ["B", [${listParam}[${index}], "A"], "C"], + "param8" : ["B", ["A", ${listParam}[${index}]], "C"], // - "param5" : ["B", [${listParam}[${index}], "A"]], // Expecting ',' delimiter: line ... - "param6" : ["B", ["A", ${listParam}[${index}]]], // Expecting ',' delimiter: line ... - "param7" : ["B", [${listParam}[${index}], "A"], "C"], // Expecting ':' delimiter: line ... - "param8" : ["B", ["A", ${listParam}[${index}]], "C"], // Expecting ',' delimiter: line ... + "param9" : [${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]], // - // Error: 'Invalid expression while handling the parameter '[${listParam}[${index}]'.'! - "param9" : [${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]] + "param10" : "[${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]]" } """) listCodeSnippets.append("""{ - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/259 "dictParam1" : {"kA" : "A", "kB" : "B"}, "dictParam2" : {"kA" : "A", "kB" : "B"}, From 773326f3f7989001721a0c4187d379f34edc699e Mon Sep 17 00:00:00 2001 From: qth2hi Date: Wed, 17 Apr 2024 17:38:54 +0200 Subject: [PATCH 7/8] Self test maintenance w.r.t. latest bug fixes (2) --- test/JPP_TestUsecases.csv | 6 + test/JPP_TestUsecases.html | 230 ++++++++++++++++-- test/JPP_TestUsecases.rst | 62 ++++- test/JPP_TestUsecases.txt | 26 +- test/component_test.py | 2 +- .../test_16_NESTED_LISTS_GOODCASE.py | 40 +++ ....py => test_17_STRING_INDICES_GOODCASE.py} | 4 +- ...est_18_NOT_EXISTING_PARAMETERS_BADCASE.py} | 44 +++- ...ASE.py => test_19_LINE_BREAKS_GOODCASE.py} | 4 +- ...y => test_20_SELF_ASSIGNMENTS_GOODCASE.py} | 4 +- ...t_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py} | 4 +- test/testconfig/TestConfig.py | 20 +- test/testfiles/jpp-test_config_1662.jsonp | 1 - test/testfiles/jpp-test_config_1663.jsonp | 1 - test/testfiles/jpp-test_config_1664.jsonp | 1 - test/testtools/GenSnippetsJPP.py | 4 +- 16 files changed, 408 insertions(+), 45 deletions(-) create mode 100644 test/pytest/pytestfiles/test_16_NESTED_LISTS_GOODCASE.py rename test/pytest/pytestfiles/{test_16_STRING_INDICES_GOODCASE.py => test_17_STRING_INDICES_GOODCASE.py} (97%) rename test/pytest/pytestfiles/{test_17_NOT_EXISTING_PARAMETERS_BADCASE.py => test_18_NOT_EXISTING_PARAMETERS_BADCASE.py} (71%) rename test/pytest/pytestfiles/{test_18_LINE_BREAKS_GOODCASE.py => test_19_LINE_BREAKS_GOODCASE.py} (96%) rename test/pytest/pytestfiles/{test_19_SELF_ASSIGNMENTS_GOODCASE.py => test_20_SELF_ASSIGNMENTS_GOODCASE.py} (96%) rename test/pytest/pytestfiles/{test_20_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py => test_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py} (96%) diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index 32ab9147..02502adb 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -126,18 +126,24 @@ JPP_1362|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (0:${ne JPP_1363|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (left hand side of colon) JPP_1364|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (left hand side of colon) JPP_1365|BLOCKED_SLICING|BADCASE|JSON file with blocked slicing notation (combinations with negative integer parameter) +JPP_1400|NESTED_LISTS|GOODCASE|JSON file with several nested lists JPP_1500|STRING_INDICES|GOODCASE|JSON file with several combinations with indices (standard notation) JPP_1501|STRING_INDICES|GOODCASE|JSON file with several combinations with indices (dotdict notation) JPP_1650|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (1) JPP_1651|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (2) JPP_1652|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (3) JPP_1653|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (4) +JPP_1654|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (5) JPP_1655|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (6) +JPP_1656|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (7) JPP_1657|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (8) JPP_1658|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (9) JPP_1659|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (10) JPP_1660|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (11) JPP_1661|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (12) +JPP_1662|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (13) +JPP_1663|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (14) +JPP_1664|NOT_EXISTING_PARAMETERS|BADCASE|JSON file with not existing parameters at several positions (15) JPP_1700|LINE_BREAKS|GOODCASE|JSON file with and without line breaks inside expressions JPP_1800|SELF_ASSIGNMENTS|GOODCASE|JSON file with self assignments of strings, lists and dictionaries JPP_1900|ASSIGNMENTS_BY_REFERENCE|GOODCASE|JSON file with dictionary assignments (by reference) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index 2e152904..9ea32c9b 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -4226,6 +4226,39 @@ 127 + + + +JPP_1400 + + + + +NESTED_LISTS + + + + +GOODCASE + + + + +JSON file with several nested lists
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +128 + + @@ -4256,7 +4289,7 @@ -128 +129 @@ -4289,7 +4322,7 @@ -129 +130 @@ -4322,7 +4355,7 @@ -130 +131 @@ -4355,7 +4388,7 @@ -131 +132 @@ -4388,7 +4421,7 @@ -132 +133 @@ -4421,7 +4454,40 @@ -133 +134 + + + + + +JPP_1654 + + + + +NOT_EXISTING_PARAMETERS + + + + +BADCASE + + + + +JSON file with not existing parameters at several positions (5)
+Expected: No values are returned, and JsonPreprocessor throws an exception + + +
+ + + + + + + +135 @@ -4454,7 +4520,40 @@ -134 +136 + + + + + +JPP_1656 + + + + +NOT_EXISTING_PARAMETERS + + + + +BADCASE + + + + +JSON file with not existing parameters at several positions (7)
+Expected: No values are returned, and JsonPreprocessor throws an exception + + +
+ + + + + + + +137 @@ -4487,7 +4586,7 @@ -135 +138 @@ -4520,7 +4619,7 @@ -136 +139 @@ -4553,7 +4652,7 @@ -137 +140 @@ -4586,7 +4685,7 @@ -138 +141 @@ -4619,7 +4718,106 @@ -139 +142 + + + + + +JPP_1662 + + + + +NOT_EXISTING_PARAMETERS + + + + +BADCASE + + + + +JSON file with not existing parameters at several positions (13)
+Expected: No values are returned, and JsonPreprocessor throws an exception + + +
+ + + + + + + +143 + + + + + +JPP_1663 + + + + +NOT_EXISTING_PARAMETERS + + + + +BADCASE + + + + +JSON file with not existing parameters at several positions (14)
+Expected: No values are returned, and JsonPreprocessor throws an exception + + +
+ + + + + + + +144 + + + + + +JPP_1664 + + + + +NOT_EXISTING_PARAMETERS + + + + +BADCASE + + + + +JSON file with not existing parameters at several positions (15)
+Expected: No values are returned, and JsonPreprocessor throws an exception + + +
+ + + + + + + +145 @@ -4652,7 +4850,7 @@ -140 +146 @@ -4685,7 +4883,7 @@ -141 +147 @@ -4718,7 +4916,7 @@ -142 +148 @@ -4751,7 +4949,7 @@

 

-
Generated: 12.04.2024 - 16:42:21
+
Generated: 17.04.2024 - 17:34:51
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index a5fb66fc..fc15acd4 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -1343,6 +1343,16 @@ Test Use Cases ---- +* **Test JPP_1400** + + [NESTED_LISTS / GOODCASE] + + **JSON file with several nested lists** + + Expected: JsonPreprocessor returns expected value + +---- + * **Test JPP_1500** [STRING_INDICES / GOODCASE] @@ -1403,6 +1413,16 @@ Test Use Cases ---- +* **Test JPP_1654** + + [NOT_EXISTING_PARAMETERS / BADCASE] + + **JSON file with not existing parameters at several positions (5)** + + Expected: No values are returned, and JsonPreprocessor throws an exception + +---- + * **Test JPP_1655** [NOT_EXISTING_PARAMETERS / BADCASE] @@ -1413,6 +1433,16 @@ Test Use Cases ---- +* **Test JPP_1656** + + [NOT_EXISTING_PARAMETERS / BADCASE] + + **JSON file with not existing parameters at several positions (7)** + + Expected: No values are returned, and JsonPreprocessor throws an exception + +---- + * **Test JPP_1657** [NOT_EXISTING_PARAMETERS / BADCASE] @@ -1463,6 +1493,36 @@ Test Use Cases ---- +* **Test JPP_1662** + + [NOT_EXISTING_PARAMETERS / BADCASE] + + **JSON file with not existing parameters at several positions (13)** + + Expected: No values are returned, and JsonPreprocessor throws an exception + +---- + +* **Test JPP_1663** + + [NOT_EXISTING_PARAMETERS / BADCASE] + + **JSON file with not existing parameters at several positions (14)** + + Expected: No values are returned, and JsonPreprocessor throws an exception + +---- + +* **Test JPP_1664** + + [NOT_EXISTING_PARAMETERS / BADCASE] + + **JSON file with not existing parameters at several positions (15)** + + Expected: No values are returned, and JsonPreprocessor throws an exception + +---- + * **Test JPP_1700** [LINE_BREAKS / GOODCASE] @@ -1503,5 +1563,5 @@ Test Use Cases ---- -Generated: 12.04.2024 - 16:42:21 +Generated: 17.04.2024 - 17:34:51 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 0b4d7690..48c16c0c 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -553,6 +553,10 @@ Test JPP_1365 / BLOCKED_SLICING / BADCASE Description: JSON file with blocked slicing notation (combinations with negative integer parameter) Expectation: No values are returned, and JsonPreprocessor throws an exception ------------------------------------------------------------------------------------------------------------------------ +Test JPP_1400 / NESTED_LISTS / GOODCASE +Description: JSON file with several nested lists +Expectation: JsonPreprocessor returns expected value +------------------------------------------------------------------------------------------------------------------------ Test JPP_1500 / STRING_INDICES / GOODCASE Description: JSON file with several combinations with indices (standard notation) Expectation: JsonPreprocessor returns expected value @@ -577,10 +581,18 @@ Test JPP_1653 / NOT_EXISTING_PARAMETERS / BADCASE Description: JSON file with not existing parameters at several positions (4) Expectation: No values are returned, and JsonPreprocessor throws an exception ------------------------------------------------------------------------------------------------------------------------ +Test JPP_1654 / NOT_EXISTING_PARAMETERS / BADCASE +Description: JSON file with not existing parameters at several positions (5) +Expectation: No values are returned, and JsonPreprocessor throws an exception +------------------------------------------------------------------------------------------------------------------------ Test JPP_1655 / NOT_EXISTING_PARAMETERS / BADCASE Description: JSON file with not existing parameters at several positions (6) Expectation: No values are returned, and JsonPreprocessor throws an exception ------------------------------------------------------------------------------------------------------------------------ +Test JPP_1656 / NOT_EXISTING_PARAMETERS / BADCASE +Description: JSON file with not existing parameters at several positions (7) +Expectation: No values are returned, and JsonPreprocessor throws an exception +------------------------------------------------------------------------------------------------------------------------ Test JPP_1657 / NOT_EXISTING_PARAMETERS / BADCASE Description: JSON file with not existing parameters at several positions (8) Expectation: No values are returned, and JsonPreprocessor throws an exception @@ -601,6 +613,18 @@ Test JPP_1661 / NOT_EXISTING_PARAMETERS / BADCASE Description: JSON file with not existing parameters at several positions (12) Expectation: No values are returned, and JsonPreprocessor throws an exception ------------------------------------------------------------------------------------------------------------------------ +Test JPP_1662 / NOT_EXISTING_PARAMETERS / BADCASE +Description: JSON file with not existing parameters at several positions (13) +Expectation: No values are returned, and JsonPreprocessor throws an exception +------------------------------------------------------------------------------------------------------------------------ +Test JPP_1663 / NOT_EXISTING_PARAMETERS / BADCASE +Description: JSON file with not existing parameters at several positions (14) +Expectation: No values are returned, and JsonPreprocessor throws an exception +------------------------------------------------------------------------------------------------------------------------ +Test JPP_1664 / NOT_EXISTING_PARAMETERS / BADCASE +Description: JSON file with not existing parameters at several positions (15) +Expectation: No values are returned, and JsonPreprocessor throws an exception +------------------------------------------------------------------------------------------------------------------------ Test JPP_1700 / LINE_BREAKS / GOODCASE Description: JSON file with and without line breaks inside expressions Expectation: JsonPreprocessor returns expected value @@ -617,5 +641,5 @@ Test JPP_1901 / ASSIGNMENTS_BY_REFERENCE / GOODCASE Description: JSON file with list assignments (by reference) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ -Generated: 12.04.2024 - 16:42:21 +Generated: 17.04.2024 - 17:34:51 diff --git a/test/component_test.py b/test/component_test.py index 30ff6f03..584cfc3e 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.43.0" +VERSION = "0.44.0" VERSION_DATE = "17.04.2024" # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_16_NESTED_LISTS_GOODCASE.py b/test/pytest/pytestfiles/test_16_NESTED_LISTS_GOODCASE.py new file mode 100644 index 00000000..8ff1947b --- /dev/null +++ b/test/pytest/pytestfiles/test_16_NESTED_LISTS_GOODCASE.py @@ -0,0 +1,40 @@ +# ************************************************************************************************************** +# Copyright 2020-2023 Robert Bosch GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# -------------------------------------------------------------------------------------------------------------- +# +# test_16_NESTED_LISTS_GOODCASE.py +# +# XC-CT/ECA3-Queckenstedt +# +# 17.04.2024 - 17:34:52 +# +# -------------------------------------------------------------------------------------------------------------- + +import pytest +from pytestlibs.CExecute import CExecute + +# -------------------------------------------------------------------------------------------------------------- + +class Test_NESTED_LISTS_GOODCASE: + +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns expected value + @pytest.mark.parametrize( + "Description", ["JSON file with several nested lists",] + ) + def test_JPP_1400(self, Description): + nReturn = CExecute.Execute("JPP_1400") + assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py b/test/pytest/pytestfiles/test_17_STRING_INDICES_GOODCASE.py similarity index 97% rename from test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py rename to test/pytest/pytestfiles/test_17_STRING_INDICES_GOODCASE.py index 92ca7866..d372bdb4 100644 --- a/test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py +++ b/test/pytest/pytestfiles/test_17_STRING_INDICES_GOODCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_16_STRING_INDICES_GOODCASE.py +# test_17_STRING_INDICES_GOODCASE.py # # XC-CT/ECA3-Queckenstedt # -# 12.04.2024 - 16:42:21 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_17_NOT_EXISTING_PARAMETERS_BADCASE.py b/test/pytest/pytestfiles/test_18_NOT_EXISTING_PARAMETERS_BADCASE.py similarity index 71% rename from test/pytest/pytestfiles/test_17_NOT_EXISTING_PARAMETERS_BADCASE.py rename to test/pytest/pytestfiles/test_18_NOT_EXISTING_PARAMETERS_BADCASE.py index cab43f49..927bdc26 100644 --- a/test/pytest/pytestfiles/test_17_NOT_EXISTING_PARAMETERS_BADCASE.py +++ b/test/pytest/pytestfiles/test_18_NOT_EXISTING_PARAMETERS_BADCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_17_NOT_EXISTING_PARAMETERS_BADCASE.py +# test_18_NOT_EXISTING_PARAMETERS_BADCASE.py # # XC-CT/ECA3-Queckenstedt # -# 26.03.2024 - 14:29:20 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- @@ -61,6 +61,14 @@ def test_JPP_1652(self, Description): def test_JPP_1653(self, Description): nReturn = CExecute.Execute("JPP_1653") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: No values are returned, and JsonPreprocessor throws an exception + @pytest.mark.parametrize( + "Description", ["JSON file with not existing parameters at several positions (5)",] + ) + def test_JPP_1654(self, Description): + nReturn = CExecute.Execute("JPP_1654") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- # Expected: No values are returned, and JsonPreprocessor throws an exception @pytest.mark.parametrize( @@ -69,6 +77,14 @@ def test_JPP_1653(self, Description): def test_JPP_1655(self, Description): nReturn = CExecute.Execute("JPP_1655") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: No values are returned, and JsonPreprocessor throws an exception + @pytest.mark.parametrize( + "Description", ["JSON file with not existing parameters at several positions (7)",] + ) + def test_JPP_1656(self, Description): + nReturn = CExecute.Execute("JPP_1656") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- # Expected: No values are returned, and JsonPreprocessor throws an exception @pytest.mark.parametrize( @@ -109,4 +125,28 @@ def test_JPP_1660(self, Description): def test_JPP_1661(self, Description): nReturn = CExecute.Execute("JPP_1661") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: No values are returned, and JsonPreprocessor throws an exception + @pytest.mark.parametrize( + "Description", ["JSON file with not existing parameters at several positions (13)",] + ) + def test_JPP_1662(self, Description): + nReturn = CExecute.Execute("JPP_1662") + assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: No values are returned, and JsonPreprocessor throws an exception + @pytest.mark.parametrize( + "Description", ["JSON file with not existing parameters at several positions (14)",] + ) + def test_JPP_1663(self, Description): + nReturn = CExecute.Execute("JPP_1663") + assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: No values are returned, and JsonPreprocessor throws an exception + @pytest.mark.parametrize( + "Description", ["JSON file with not existing parameters at several positions (15)",] + ) + def test_JPP_1664(self, Description): + nReturn = CExecute.Execute("JPP_1664") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_18_LINE_BREAKS_GOODCASE.py b/test/pytest/pytestfiles/test_19_LINE_BREAKS_GOODCASE.py similarity index 96% rename from test/pytest/pytestfiles/test_18_LINE_BREAKS_GOODCASE.py rename to test/pytest/pytestfiles/test_19_LINE_BREAKS_GOODCASE.py index 641702a7..f63d22e3 100644 --- a/test/pytest/pytestfiles/test_18_LINE_BREAKS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_19_LINE_BREAKS_GOODCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_18_LINE_BREAKS_GOODCASE.py +# test_19_LINE_BREAKS_GOODCASE.py # # XC-CT/ECA3-Queckenstedt # -# 03.04.2024 - 09:23:46 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_19_SELF_ASSIGNMENTS_GOODCASE.py b/test/pytest/pytestfiles/test_20_SELF_ASSIGNMENTS_GOODCASE.py similarity index 96% rename from test/pytest/pytestfiles/test_19_SELF_ASSIGNMENTS_GOODCASE.py rename to test/pytest/pytestfiles/test_20_SELF_ASSIGNMENTS_GOODCASE.py index bb055be5..cc277239 100644 --- a/test/pytest/pytestfiles/test_19_SELF_ASSIGNMENTS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_20_SELF_ASSIGNMENTS_GOODCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_19_SELF_ASSIGNMENTS_GOODCASE.py +# test_20_SELF_ASSIGNMENTS_GOODCASE.py # # XC-CT/ECA3-Queckenstedt # -# 03.04.2024 - 09:23:46 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_20_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py b/test/pytest/pytestfiles/test_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py similarity index 96% rename from test/pytest/pytestfiles/test_20_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py rename to test/pytest/pytestfiles/test_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py index 199c89ee..f253da11 100644 --- a/test/pytest/pytestfiles/test_20_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py +++ b/test/pytest/pytestfiles/test_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_20_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py +# test_21_ASSIGNMENTS_BY_REFERENCE_GOODCASE.py # # XC-CT/ECA3-Queckenstedt # -# 08.04.2024 - 14:47:37 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index cf0abe64..84b769a2 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -3229,9 +3229,9 @@ dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1654.jsonp" -dictUsecase['EXPECTEDEXCEPTION'] = None # 'Invalid expression found +dictUsecase['EXPECTEDEXCEPTION'] = "'The variable '${IAMNOTEXISTING2}' is not available!'" dictUsecase['EXPECTEDRETURN'] = None -# # # listofdictUsecases.append(dictUsecase) +listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} @@ -3257,9 +3257,9 @@ dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1656.jsonp" -dictUsecase['EXPECTEDEXCEPTION'] = None # Invalid expression found +dictUsecase['EXPECTEDEXCEPTION'] = "'The variable '${IAMNOTEXISTING2}' is not available!'" dictUsecase['EXPECTEDRETURN'] = None -# # # listofdictUsecases.append(dictUsecase) +listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} @@ -3341,9 +3341,9 @@ dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1662.jsonp" -dictUsecase['EXPECTEDEXCEPTION'] = None # [STR] : '${listP}[${IAMNOTEXISTING}]' +dictUsecase['EXPECTEDEXCEPTION'] = "'The variable '${IAMNOTEXISTING}' is not available!'" dictUsecase['EXPECTEDRETURN'] = None -# # # listofdictUsecases.append(dictUsecase) +listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} @@ -3355,9 +3355,9 @@ dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1663.jsonp" -dictUsecase['EXPECTEDEXCEPTION'] = None # '${listP}[${IAMNOTEXISTING}]' +dictUsecase['EXPECTEDEXCEPTION'] = "'The variable '${IAMNOTEXISTING}' is not available!'" dictUsecase['EXPECTEDRETURN'] = None -# # # listofdictUsecases.append(dictUsecase) +listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} @@ -3369,9 +3369,9 @@ dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1664.jsonp" -dictUsecase['EXPECTEDEXCEPTION'] = None # Expecting ':' delimiter: line +dictUsecase['EXPECTEDEXCEPTION'] = "'The variable '${IAMNOTEXISTING}' is not available!'" dictUsecase['EXPECTEDRETURN'] = None -# # # listofdictUsecases.append(dictUsecase) +listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- diff --git a/test/testfiles/jpp-test_config_1662.jsonp b/test/testfiles/jpp-test_config_1662.jsonp index 1a191a90..9c57ea5d 100644 --- a/test/testfiles/jpp-test_config_1662.jsonp +++ b/test/testfiles/jpp-test_config_1662.jsonp @@ -14,7 +14,6 @@ //************************************************************************** { - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [{"ABC" : [${listP}[${IAMNOTEXISTING}], "DEF"]}, "GHI"] } diff --git a/test/testfiles/jpp-test_config_1663.jsonp b/test/testfiles/jpp-test_config_1663.jsonp index 23325a24..911efcce 100644 --- a/test/testfiles/jpp-test_config_1663.jsonp +++ b/test/testfiles/jpp-test_config_1663.jsonp @@ -14,7 +14,6 @@ //************************************************************************** { - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [{"ABC" : ["DEF", ${listP}[${IAMNOTEXISTING}]]}, "GHI"] } diff --git a/test/testfiles/jpp-test_config_1664.jsonp b/test/testfiles/jpp-test_config_1664.jsonp index 8aeffb85..2a5c6033 100644 --- a/test/testfiles/jpp-test_config_1664.jsonp +++ b/test/testfiles/jpp-test_config_1664.jsonp @@ -14,7 +14,6 @@ //************************************************************************** { - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [[[${listP}[${IAMNOTEXISTING}], 123], ${listP}[${IAMNOTEXISTING}]], ${listP}[${IAMNOTEXISTING}]] } diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index 0d9a7da3..2ab35646 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,7 +22,7 @@ # # ************************************************************************************************************** # -VERSION = "0.26.1" +VERSION = "0.26.2" VERSION_DATE = "17.04.2024" # # ************************************************************************************************************** @@ -1148,14 +1148,12 @@ def GetSeveralParticularSnippets(self): """) listCodeSnippets.append("""{ - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [{"ABC" : [${listP}[${IAMNOTEXISTING}], "DEF"]}, "GHI"] } """) listCodeSnippets.append("""{ - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [{"ABC" : ["DEF", ${listP}[${IAMNOTEXISTING}]]}, "GHI"] } From f75e7845992ffc0895e0e1455d29177feae4a7af Mon Sep 17 00:00:00 2001 From: qth2hi Date: Wed, 17 Apr 2024 20:07:25 +0200 Subject: [PATCH 8/8] Self test maintenance w.r.t. latest bug fixes (3) --- test/JPP_TestUsecases.csv | 1 + test/JPP_TestUsecases.html | 133 +++++++++++------- test/JPP_TestUsecases.rst | 12 +- test/JPP_TestUsecases.txt | 6 +- test/component_test.py | 2 +- .../test_11_IMPLICIT_CREATION_GOODCASE.py | 10 +- test/testconfig/TestConfig.py | 19 +++ test/testfiles/jpp-test_config_1004.jsonp | 34 +++++ test/testtools/GenSnippetsJPP.py | 14 +- 9 files changed, 176 insertions(+), 55 deletions(-) create mode 100644 test/testfiles/jpp-test_config_1004.jsonp diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index 02502adb..f1377b55 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -98,6 +98,7 @@ JPP_1000|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created JPP_1001|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created implicitly (same key names at all levels) JPP_1002|IMPLICIT_CREATION|GOODCASE|JSON file with combinations of implicit and explicit creation / with and without initialization JPP_1003|IMPLICIT_CREATION|GOODCASE|JSON file with combinations of implicit and explicit creation / access to implicitly created keys by parameters / dict assignment by reference +JPP_1004|IMPLICIT_CREATION|GOODCASE|JSON file with combinations of ascending and descending dotdict syntax JPP_1050|IMPLICIT_CREATION|BADCASE|JSON file with implicit creation of data structures based on parameters (1) JPP_1051|IMPLICIT_CREATION|BADCASE|JSON file with implicit creation of data structures based on parameters (2) JPP_1052|IMPLICIT_CREATION|BADCASE|JSON file with implicit creation of data structures based on parameters (3) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index 9ea32c9b..741b0964 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -3301,6 +3301,39 @@ 99
+ + + +JPP_1004 + + + + +IMPLICIT_CREATION + + + + +GOODCASE + + + + +JSON file with combinations of ascending and descending dotdict syntax
+Expected: JsonPreprocessor returns values + + +
+ + + + + + + +100 + + @@ -3331,7 +3364,7 @@ -100 +101 @@ -3364,7 +3397,7 @@ -101 +102 @@ -3397,7 +3430,7 @@ -102 +103 @@ -3430,7 +3463,7 @@ -103 +104 @@ -3463,7 +3496,7 @@ -104 +105 @@ -3496,7 +3529,7 @@ -105 +106 @@ -3529,7 +3562,7 @@ -106 +107 @@ -3562,7 +3595,7 @@ -107 +108 @@ -3595,7 +3628,7 @@ -108 +109 @@ -3628,7 +3661,7 @@ -109 +110 @@ -3661,7 +3694,7 @@ -110 +111 @@ -3695,7 +3728,7 @@ -111 +112 @@ -3728,7 +3761,7 @@ -112 +113 @@ -3761,7 +3794,7 @@ -113 +114 @@ -3794,7 +3827,7 @@ -114 +115 @@ -3827,7 +3860,7 @@ -115 +116 @@ -3860,7 +3893,7 @@ -116 +117 @@ -3893,7 +3926,7 @@ -117 +118 @@ -3926,7 +3959,7 @@ -118 +119 @@ -3959,7 +3992,7 @@ -119 +120 @@ -3992,7 +4025,7 @@ -120 +121 @@ -4025,7 +4058,7 @@ -121 +122 @@ -4058,7 +4091,7 @@ -122 +123 @@ -4091,7 +4124,7 @@ -123 +124 @@ -4124,7 +4157,7 @@ -124 +125 @@ -4157,7 +4190,7 @@ -125 +126 @@ -4190,7 +4223,7 @@ -126 +127 @@ -4223,7 +4256,7 @@ -127 +128 @@ -4256,7 +4289,7 @@ -128 +129 @@ -4289,7 +4322,7 @@ -129 +130 @@ -4322,7 +4355,7 @@ -130 +131 @@ -4355,7 +4388,7 @@ -131 +132 @@ -4388,7 +4421,7 @@ -132 +133 @@ -4421,7 +4454,7 @@ -133 +134 @@ -4454,7 +4487,7 @@ -134 +135 @@ -4487,7 +4520,7 @@ -135 +136 @@ -4520,7 +4553,7 @@ -136 +137 @@ -4553,7 +4586,7 @@ -137 +138 @@ -4586,7 +4619,7 @@ -138 +139 @@ -4619,7 +4652,7 @@ -139 +140 @@ -4652,7 +4685,7 @@ -140 +141 @@ -4685,7 +4718,7 @@ -141 +142 @@ -4718,7 +4751,7 @@ -142 +143 @@ -4751,7 +4784,7 @@ -143 +144 @@ -4784,7 +4817,7 @@ -144 +145 @@ -4817,7 +4850,7 @@ -145 +146 @@ -4850,7 +4883,7 @@ -146 +147 @@ -4883,7 +4916,7 @@ -147 +148 @@ -4916,7 +4949,7 @@ -148 +149 @@ -4949,7 +4982,7 @@
 

-
Generated: 17.04.2024 - 17:34:51
+
Generated: 17.04.2024 - 20:03:38
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index fc15acd4..e1848a4a 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -1061,6 +1061,16 @@ Test Use Cases ---- +* **Test JPP_1004** + + [IMPLICIT_CREATION / GOODCASE] + + **JSON file with combinations of ascending and descending dotdict syntax** + + Expected: JsonPreprocessor returns values + +---- + * **Test JPP_1050** [IMPLICIT_CREATION / BADCASE] @@ -1563,5 +1573,5 @@ Test Use Cases ---- -Generated: 17.04.2024 - 17:34:51 +Generated: 17.04.2024 - 20:03:38 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 48c16c0c..21c6fd2d 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -440,6 +440,10 @@ Test JPP_1003 / IMPLICIT_CREATION / GOODCASE Description: JSON file with combinations of implicit and explicit creation / access to implicitly created keys by parameters / dict assignment by reference Expectation: JsonPreprocessor returns values ------------------------------------------------------------------------------------------------------------------------ +Test JPP_1004 / IMPLICIT_CREATION / GOODCASE +Description: JSON file with combinations of ascending and descending dotdict syntax +Expectation: JsonPreprocessor returns values +------------------------------------------------------------------------------------------------------------------------ Test JPP_1050 / IMPLICIT_CREATION / BADCASE Description: JSON file with implicit creation of data structures based on parameters (1) Expectation: No values are returned, and JsonPreprocessor throws an exception @@ -641,5 +645,5 @@ Test JPP_1901 / ASSIGNMENTS_BY_REFERENCE / GOODCASE Description: JSON file with list assignments (by reference) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ -Generated: 17.04.2024 - 17:34:51 +Generated: 17.04.2024 - 20:03:38 diff --git a/test/component_test.py b/test/component_test.py index 584cfc3e..29ae1687 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.44.0" +VERSION = "0.45.0" VERSION_DATE = "17.04.2024" # # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py b/test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py index 996c5720..288a499a 100644 --- a/test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py +++ b/test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 07.03.2024 - 14:58:30 +# 17.04.2024 - 20:03:38 # # -------------------------------------------------------------------------------------------------------------- @@ -61,4 +61,12 @@ def test_JPP_1002(self, Description): def test_JPP_1003(self, Description): nReturn = CExecute.Execute("JPP_1003") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns values + @pytest.mark.parametrize( + "Description", ["JSON file with combinations of ascending and descending dotdict syntax",] + ) + def test_JPP_1004(self, Description): + nReturn = CExecute.Execute("JPP_1004") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index 84b769a2..2fc96434 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -2603,6 +2603,25 @@ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +dictUsecase['TESTID'] = "JPP_1004" +dictUsecase['DESCRIPTION'] = "JSON file with combinations of ascending and descending dotdict syntax" +dictUsecase['EXPECTATION'] = "JsonPreprocessor returns values" +dictUsecase['SECTION'] = "IMPLICIT_CREATION" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1004.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (4/1) > {testdict4} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 20 +[DICT] (4/2) > {testdict1} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 4 +[DICT] (4/3) > {testdict2} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 9 +[DICT] (4/4) > {testdict3} [DICT] (1/1) > {subKey1} [DICT] (1/1) > {subKey2} [DICT] (1/1) > {subKey3} [DICT] (1/1) > {subKey4} [INT] : 10 +""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_1050" diff --git a/test/testfiles/jpp-test_config_1004.jsonp b/test/testfiles/jpp-test_config_1004.jsonp new file mode 100644 index 00000000..78b2fbff --- /dev/null +++ b/test/testfiles/jpp-test_config_1004.jsonp @@ -0,0 +1,34 @@ +// Copyright 2020-2024 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** + +{ + // implicit creation in ascending dotdict syntax: + ${testdict1} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 0}}}}, + ${testdict1.subKey1} : {"subKey2" : {"subKey3" : {"subKey4" : 1}}}, + ${testdict1.subKey1.subKey2} : {"subKey3" : {"subKey4" : 2}}, + ${testdict1.subKey1.subKey2.subKey3} : {"subKey4" : 3}, + ${testdict1.subKey1.subKey2.subKey3.subKey4} : 4, + // + // values overwritten in descending dotdict syntax: + ${testdict2.subKey1.subKey2.subKey3.subKey4} : 5, + ${testdict2.subKey1.subKey2.subKey3} : {"subKey4" : 6}, + ${testdict2.subKey1.subKey2} : {"subKey3" : {"subKey4" : 7}}, + ${testdict2.subKey1} : {"subKey2" : {"subKey3" : {"subKey4" : 8}}}, + ${testdict2} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 9}}}}, + // + // cross check: + ${testdict3} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 10}}}}, + "testdict4" : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 20}}}} +} diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index 2ab35646..378dac8c 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,7 +22,7 @@ # # ************************************************************************************************************** # -VERSION = "0.26.2" +VERSION = "0.27.0" VERSION_DATE = "17.04.2024" # # ************************************************************************************************************** @@ -1193,18 +1193,21 @@ def GetSeveralParticularSnippets(self): """) listCodeSnippets.append("""{ + // implicit creation in ascending dotdict syntax: ${testdict1} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 0}}}}, ${testdict1.subKey1} : {"subKey2" : {"subKey3" : {"subKey4" : 1}}}, ${testdict1.subKey1.subKey2} : {"subKey3" : {"subKey4" : 2}}, ${testdict1.subKey1.subKey2.subKey3} : {"subKey4" : 3}, ${testdict1.subKey1.subKey2.subKey3.subKey4} : 4, // + // values overwritten in descending dotdict syntax: ${testdict2.subKey1.subKey2.subKey3.subKey4} : 5, ${testdict2.subKey1.subKey2.subKey3} : {"subKey4" : 6}, ${testdict2.subKey1.subKey2} : {"subKey3" : {"subKey4" : 7}}, ${testdict2.subKey1} : {"subKey2" : {"subKey3" : {"subKey4" : 8}}}, ${testdict2} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 9}}}}, // + // cross check: ${testdict3} : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 10}}}}, "testdict4" : {"subKey1" : {"subKey2" : {"subKey3" : {"subKey4" : 20}}}} } @@ -1248,6 +1251,15 @@ def GetSeveralParticularSnippets(self): "newparam_8" : "${${dictP}['${${${dictP}['${${${dictP}['${keyP}']}}']}}']}", // => "${B}" -> 'keyP' "newparam_9" : "${${${dictP}['${${${dictP}['${${${dictP}['${keyP}']}}']}}']}}" // => "${keyP}" -> 'A' } +""") + + listCodeSnippets.append("""{ +"keyP" : "A", +"B" : 1, +"dictP" : {"A" : "B", "C" : 2}, +"newparam_1" : "${${dictP}[${keyP}]}", +"newparam_2" : "${${dictP}['${keyP}']}" +} """) listCodeSnippets.append("""{