diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index aa6cf51d..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) @@ -126,18 +127,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_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_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 39d7c5bf..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,40 @@ -127 +128 + + + + + +JPP_1400 + + + + +NESTED_LISTS + + + + +GOODCASE + + + + +JSON file with several nested lists
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +129 @@ -4244,7 +4310,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 @@ -4256,7 +4322,7 @@ -128 +130 @@ -4277,7 +4343,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 @@ -4289,7 +4355,7 @@ -129 +131 @@ -4322,7 +4388,7 @@ -130 +132 @@ -4355,7 +4421,7 @@ -131 +133 @@ -4388,7 +4454,7 @@ -132 +134 @@ -4421,7 +4487,40 @@ -133 +135 + + + + + +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 + + +
+ + + + + + + +136 @@ -4454,7 +4553,40 @@ -134 +137 + + + + + +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 + + +
+ + + + + + + +138 @@ -4487,7 +4619,7 @@ -135 +139 @@ -4520,7 +4652,7 @@ -136 +140 @@ -4553,7 +4685,7 @@ -137 +141 @@ -4586,7 +4718,7 @@ -138 +142 @@ -4619,7 +4751,106 @@ -139 +143 + + + + + +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 + + +
+ + + + + + + +144 + + + + + +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 + + +
+ + + + + + + +145 + + + + + +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 + + +
+ + + + + + + +146 @@ -4652,7 +4883,7 @@ -140 +147 @@ -4685,7 +4916,7 @@ -141 +148 @@ -4718,7 +4949,7 @@ -142 +149 @@ -4751,7 +4982,7 @@
 

-
Generated: 08.04.2024 - 14:47:37
+
Generated: 17.04.2024 - 20:03:38
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index 5b8bd426..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] @@ -1343,11 +1353,21 @@ 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] - **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 +1377,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 @@ -1403,6 +1423,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 +1443,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 +1503,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 +1573,5 @@ Test Use Cases ---- -Generated: 08.04.2024 - 14:47:37 +Generated: 17.04.2024 - 20:03:38 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 054356ec..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 @@ -553,12 +557,16 @@ 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 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 @@ -577,10 +585,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 +617,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 +645,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: 17.04.2024 - 20:03:38 diff --git a/test/component_test.py b/test/component_test.py index 94a285f6..29ae1687 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.45.0" +VERSION_DATE = "17.04.2024" # # -------------------------------------------------------------------------------------------------------------- #TM*** 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/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 85% rename from test/pytest/pytestfiles/test_16_STRING_INDICES_GOODCASE.py rename to test/pytest/pytestfiles/test_17_STRING_INDICES_GOODCASE.py index e4be40a9..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 # -# 08.04.2024 - 14:47:37 +# 17.04.2024 - 17:34:52 # # -------------------------------------------------------------------------------------------------------------- @@ -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/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 960cd945..2fc96434 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 08.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,35 @@ 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 +# -------------------------------------------------------------------------------------------------------------- +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 @@ -3056,68 +3076,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 @@ -3190,9 +3248,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 = {} @@ -3218,9 +3276,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 = {} @@ -3302,9 +3360,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 = {} @@ -3316,9 +3374,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 = {} @@ -3330,9 +3388,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_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}" } - 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/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/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}}}}}"]} } 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 35fe54dd..378dac8c 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.27.0" +VERSION_DATE = "17.04.2024" # # ************************************************************************************************************** @@ -575,7 +575,7 @@ class CHTMLPattern(): """ sHTMLLink = """ -

+

###TEXT### @@ -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}" } """) @@ -1147,21 +1148,18 @@ 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"] } """) listCodeSnippets.append("""{ - // https://github.com/test-fullautomation/python-jsonpreprocessor/issues/252 "listP" : ["A", "B"], "params" : [[[${listP}[${IAMNOTEXISTING}], 123], ${listP}[${IAMNOTEXISTING}]], ${listP}[${IAMNOTEXISTING}]] } @@ -1175,8 +1173,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}}}} } """) @@ -1195,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}}}} } @@ -1250,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("""{ @@ -1348,48 +1358,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"], // Expecting ':' delimiter: line ... - "param4" : [["A", ${listParam}[${index}]], "B"], // Expecting ',' delimiter: line ... - // - "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}]] -} -""") - - listCodeSnippets.append("""{ - "stringParam" : "ABCDE", - // - "index" : 1, - "indexList" : [0,1,2], - "indexDict" : {"A" : 0, "B" : 1, "C" : 2}, - "keyList" : ["A", "B", "C"], + "param3" : [[${listParam}[${index}], "A"], "B"], + "param4" : [["A", ${listParam}[${index}]], "B"], // - "param01" : ${stringParam}[${index}], - "param02" : ${stringParam}[${indexList}[${index}]], - "param03" : ${stringParam}[${indexList}[${indexList}[${index}]]], - "param04" : ${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], + "param5" : ["B", [${listParam}[${index}], "A"]], + "param6" : ["B", ["A", ${listParam}[${index}]]], + "param7" : ["B", [${listParam}[${index}], "A"], "C"], + "param8" : ["B", ["A", ${listParam}[${index}]], "C"], // - "param05" : [${stringParam}[${index}], "D"], - "param06" : [${stringParam}[${indexList}[${index}]], "D"], - "param07" : [${stringParam}[${indexList}[${indexList}[${index}]]], "D"], - "param08" : [${stringParam}[${indexDict}[${keyList}[${indexList}[${index}]]]], "D"], + "param9" : [${listParam}[${index}], [${listParam}[${index}], ${listParam}[${index}]], ${listParam}[${index}]], // - "param09" : {"kA" : ${stringParam}[${index}]}, - "param10" : {"kA" : [${stringParam}[${index}], "D"]}, - "param11" : {"kA" : [${stringParam}[${indexList}[${index}]], "D"]}, - "param12" : {"kA" : [${stringParam}[${indexList}[${indexList}[${index}]]], "D"]} + "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"}, @@ -1423,6 +1406,613 @@ 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}]] +} +""") + + # 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} +} +""") + + # 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("""{ # } @@ -2276,7 +2866,7 @@ def GetSpacesAndLineBreaks(self): sDefinitions = """ "index" : 0, "listParam" : [0,1,2], "value" : "A", - "dictParam" : {"A" : 1, "B" : 2} + "dictParam" : {"A" : 1, "B" : 2}, """ sCodeSnippetPattern = """{ @@ -2329,6 +2919,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(): # -------------------------------------------------------------------------------------------------------------- @@ -2473,6 +3168,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()