Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/JPP_TestUsecases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,4 @@ JPP_2055|PARAMETER_SCOPE|BADCASE|JSON file containing a parameter with missing s
JPP_2056|PARAMETER_SCOPE|BADCASE|JSON file containing a parameter with missing scope (7)
JPP_2057|PARAMETER_SCOPE|BADCASE|JSON file containing a parameter with missing scope (8)
JPP_2058|PARAMETER_SCOPE|BADCASE|JSON file containing a parameter with missing scope (9)
JPP_2100|INLINE_CODE|GOODCASE|JSON file containing Python inline code
37 changes: 36 additions & 1 deletion test/JPP_TestUsecases.html
Original file line number Diff line number Diff line change
Expand Up @@ -6737,12 +6737,47 @@
</i></font></td>


</tr>
<tr valign="middle" align="left">
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
<font size="2" face="Arial" color="#FF0000">
<b>
203
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#595959">
<b>
<a target="_blank" href="https://github.com/test-fullautomation/python-jsonpreprocessor/blob/develop/test/testfiles/jpp-test_config_2100.jsonp">JPP_2100</a>
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#4169E1">
INLINE_CODE
</font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#008000">
GOODCASE
</font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="left">
<font size="2" face="Arial" color="#595959"><i>
<b>JSON file containing Python inline code</b><br>
Expected: JsonPreprocessor returns expected values
<br>
https://github.com/test-fullautomation/python-jsonpreprocessor/issues/454
<br>
Test needs to be adapted after bugfixing
</i></font></td>


</tr>

</tbody></table></div>
<div>&nbsp;</div>
<hr width="100%" color="#FF8C00" align="center">
<div align="center"><font size="2" color="#27408B">Generated: 10.04.2025 - 17:21:06</font></div>
<div align="center"><font size="2" color="#27408B">Generated: 18.07.2025 - 16:02:56</font></div>
<div>&nbsp;</div>
</body></html>

16 changes: 15 additions & 1 deletion test/JPP_TestUsecases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2125,5 +2125,19 @@ Test Use Cases

----

Generated: 10.04.2025 - 17:21:06
* **Test JPP_2100**

[INLINE_CODE / GOODCASE]

**JSON file containing Python inline code**

Expected: JsonPreprocessor returns expected values

*Comment: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/454*

*Hint: Test needs to be adapted after bugfixing*

----

Generated: 18.07.2025 - 16:02:56

8 changes: 7 additions & 1 deletion test/JPP_TestUsecases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -868,5 +868,11 @@ Test JPP_2058 / PARAMETER_SCOPE / BADCASE
Description: JSON file containing a parameter with missing scope (9)
Expectation: No values are returned, and JsonPreprocessor throws an exception
------------------------------------------------------------------------------------------------------------------------
Generated: 10.04.2025 - 17:21:06
Test JPP_2100 / INLINE_CODE / GOODCASE
Description: JSON file containing Python inline code
Expectation: JsonPreprocessor returns expected values
Comment....: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/454
Hint.......: Test needs to be adapted after bugfixing
------------------------------------------------------------------------------------------------------------------------
Generated: 18.07.2025 - 16:02:56

4 changes: 2 additions & 2 deletions test/component_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#
# --------------------------------------------------------------------------------------------------------------
#
VERSION = "0.60.0"
VERSION_DATE = "23.04.2025"
VERSION = "0.61.0"
VERSION_DATE = "18.07.2025"
#
# --------------------------------------------------------------------------------------------------------------
#TM***
Expand Down
40 changes: 40 additions & 0 deletions test/pytest/pytestfiles/test_27_INLINE_CODE_GOODCASE.py
Original file line number Diff line number Diff line change
@@ -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_27_INLINE_CODE_GOODCASE.py
#
# XC-HWP/ESW3-Queckenstedt
#
# 18.07.2025 - 16:02:56
#
# --------------------------------------------------------------------------------------------------------------

import pytest
from pytestlibs.CExecute import CExecute

# --------------------------------------------------------------------------------------------------------------

class Test_INLINE_CODE_GOODCASE:

# --------------------------------------------------------------------------------------------------------------
# Expected: JsonPreprocessor returns expected values
@pytest.mark.parametrize(
"Description", ["JSON file containing Python inline code",]
)
def test_JPP_2100(self, Description):
nReturn = CExecute.Execute("JPP_2100")
assert nReturn == 0
# --------------------------------------------------------------------------------------------------------------
51 changes: 50 additions & 1 deletion test/testconfig/TestConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
# --------------------------------------------------------------------------------------------------------------
#
# 23.04.2025
# 18.07.2025
#
# !!! Temporarily tests are deactivated by the following line commented out:
# # # listofdictUsecases.append(dictUsecase)
Expand Down Expand Up @@ -4425,3 +4425,52 @@
del dictUsecase
# --------------------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------
dictUsecase = {}
dictUsecase['TESTID'] = "JPP_2100"
dictUsecase['DESCRIPTION'] = "JSON file containing Python inline code"
dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected values"
dictUsecase['SECTION'] = "INLINE_CODE"
dictUsecase['SUBSECTION'] = "GOODCASE"
dictUsecase['HINT'] = "Test needs to be adapted after bugfixing"
dictUsecase['COMMENT'] = "https://github.com/test-fullautomation/python-jsonpreprocessor/issues/454"
dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_2100.jsonp"
dictUsecase['EXPECTEDEXCEPTION'] = None
dictUsecase['EXPECTEDRETURN'] = """
[DOTDICT] (18/1) > {A} [INT] : 0
[DOTDICT] (18/2) > {B} [INT] : 1
[DOTDICT] (18/3) > {L1} [LIST] (3/1) > [INT] : 1
[DOTDICT] (18/3) > {L1} [LIST] (3/2) > [INT] : 2
[DOTDICT] (18/3) > {L1} [LIST] (3/3) > [INT] : 3
[DOTDICT] (18/4) > {L2} [LIST] (3/1) > [INT] : 4
[DOTDICT] (18/4) > {L2} [LIST] (3/2) > [INT] : 5
[DOTDICT] (18/4) > {L2} [LIST] (3/3) > [INT] : 6
[DOTDICT] (18/5) > {kA} [STR] : 'kA'
[DOTDICT] (18/6) > {kB} [STR] : 'kB'
[DOTDICT] (18/7) > {D1} [DOTDICT] (2/1) > {kA} [STR] : 'vA'
[DOTDICT] (18/7) > {D1} [DOTDICT] (2/2) > {kB} [STR] : 'vB'
[DOTDICT] (18/8) > {choice} [BOOL] : True
[DOTDICT] (18/9) > {value01} [INT] : 10
[DOTDICT] (18/10) > {value02} [LIST] (2/1) > [INT] : 1
[DOTDICT] (18/10) > {value02} [LIST] (2/2) > [INT] : 2
[DOTDICT] (18/11) > {value04} [INT] : 4
[DOTDICT] (18/12) > {code04} [STR] : '0 if True else 1'
[DOTDICT] (18/13) > {value04b} [INT] : 4
[DOTDICT] (18/14) > {value05} [INT] : 5
[DOTDICT] (18/15) > {code05} [STR] : '0 if not True else 1'
[DOTDICT] (18/16) > {value05b} [INT] : 5
[DOTDICT] (18/17) > {values01} [DOTDICT] (3/1) > {kA} [STR] : 'A'
[DOTDICT] (18/17) > {values01} [DOTDICT] (3/2) > {kB} [INT] : 0
[DOTDICT] (18/17) > {values01} [DOTDICT] (3/3) > {kC} [STR] : 'Z'
[DOTDICT] (18/18) > {values02} [LIST] (4/1) > [INT] : 1
[DOTDICT] (18/18) > {values02} [LIST] (4/2) > [INT] : 2
[DOTDICT] (18/18) > {values02} [LIST] (4/3) > [INT] : 3
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/1) > [INT] : 4
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/2) > [INT] : 5
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/3) > [INT] : 6
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/4) > [INT] : 1
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/5) > [INT] : 2
[DOTDICT] (18/18) > {values02} [LIST] (4/4) > [LIST] (6/6) > [INT] : 3
"""
listofdictUsecases.append(dictUsecase)
del dictUsecase
# --------------------------------------------------------------------------------------------------------------
48 changes: 48 additions & 0 deletions test/testfiles/jpp-test_config_2100.jsonp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2020-2025 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 needs to be adapted after bugfixing
// https://github.com/test-fullautomation/python-jsonpreprocessor/issues/454
//
"A" : 0,
"B" : 1,
"L1" : [1,2,3],
"L2" : [4,5,6],
"kA" : "kA",
"kB" : "kB",
"D1" : {"kA" : "vA", "kB" : "vB"},
"choice" : True,
//
"value01" : <<eval 10>>,
"value02" : <<eval [1,2]>>,
// !err! "value03" : <<eval {"A" : 1, "B" : 2}>>,
//
"value04" : <<eval (${A} if ${choice} else ${B}) + 4>>,
"code04" : "${A} if ${choice} else ${B}",
"value04b" : <<eval (${code04}) + 4>>,
"value05" : <<eval (${A} if not ${choice} else ${B}) + 4>>,
"code05" : "${A} if not ${choice} else ${B}",
"value05b" : <<eval (${code05}) + 4>>,
//
"values01" : {"kA" : "A",
"kB" : <<eval ${A} if ${choice} else ${B}>>,
"kC" : "Z"},
//
"values02" : <<eval ${L1} + [${L2} + ${L1}]>>
//
// !err! "value06" : ${L1}[<<eval ${A} if ${choice} else ${B}>>]
//
// !err! "value07" : ${D1}[<<eval "${kA}" if ${choice} else "${kB}">>]
}