Skip to content

Commit a4dadd0

Browse files
committed
Debug script added (osd6_issue_test)
1 parent d294a0e commit a4dadd0

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

testD/osd6_issue_test.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# **************************************************************************************************************
2+
#
3+
# Copyright 2020-2025 Robert Bosch GmbH
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# **************************************************************************************************************
18+
#
19+
# osd6_issue_test.py
20+
#
21+
# XC-HWP/ESW3-Queckenstedt
22+
#
23+
# --------------------------------------------------------------------------------------------------------------
24+
#
25+
VERSION = "0.1.0"
26+
VERSION_DATE = "28.01.2025"
27+
#
28+
# --------------------------------------------------------------------------------------------------------------
29+
30+
import os, sys, time, platform
31+
import colorama as col
32+
33+
from PythonExtensionsCollection.String.CString import CString
34+
from PythonExtensionsCollection.Utils.CUtils import *
35+
36+
from robot import get_version
37+
38+
# --------------------------------------------------------------------------------------------------------------
39+
# !!! the module under test !!!
40+
from JsonPreprocessor.CJsonPreprocessor import CJsonPreprocessor
41+
# --------------------------------------------------------------------------------------------------------------
42+
43+
col.init(autoreset=True)
44+
45+
COLBR = col.Style.BRIGHT + col.Fore.RED
46+
COLBY = col.Style.BRIGHT + col.Fore.YELLOW
47+
COLBG = col.Style.BRIGHT + col.Fore.GREEN
48+
COLBB = col.Style.BRIGHT + col.Fore.BLUE
49+
50+
SUCCESS = 0
51+
ERROR = 1
52+
53+
# --------------------------------------------------------------------------------------------------------------
54+
55+
def printerror(sMsg, prefix=None):
56+
if prefix is None:
57+
sError = COLBR + f"Error: {sMsg}!\n\n"
58+
else:
59+
sError = COLBR + f"{prefix}:\n{sMsg}!\n\n"
60+
sys.stderr.write(sError)
61+
62+
# --------------------------------------------------------------------------------------------------------------
63+
# [EXECUTION]
64+
# --------------------------------------------------------------------------------------------------------------
65+
#TM***
66+
67+
print("Executing osd6_issue_test")
68+
print()
69+
70+
# !!! the object under test !!!
71+
oJsonPreprocessor = CJsonPreprocessor()
72+
73+
json_strdata = """
74+
{
75+
"C" : 1,
76+
"params" : [
77+
2,
78+
{"A" : 3,
79+
"B" : [
80+
{
81+
"C" : 4,
82+
${params.1.B.0.C} : 10,
83+
"D" : 5,
84+
${params}[1]['B'][0]['D'] : 11
85+
},
86+
6
87+
]
88+
},
89+
7
90+
]
91+
}
92+
"""
93+
94+
parsed_data_jpp = oJsonPreprocessor.jsonLoads(json_strdata)
95+
PrettyPrintD(parsed_data_jpp)
96+
97+
print()
98+
print("===== Environment")
99+
print()
100+
101+
sOSName = os.name
102+
sPlatformSystem = platform.system()
103+
sPython = sys.executable
104+
sPythonVersion = sys.version
105+
106+
print(f" OS....: {sOSName} / {sPlatformSystem}")
107+
print(f" Python: {sPythonVersion} / '{sPython}'")
108+
print()
109+
110+
ROBOTFRAMEWORKVERSION = get_version()
111+
print(f" RF: {ROBOTFRAMEWORKVERSION}")
112+
print()
113+
114+
print("===== Installed packages")
115+
print()
116+
117+
listofTuplesPackages, bSuccess, sResult = CUtils.GetInstalledPackages()
118+
119+
for tuplePackages in listofTuplesPackages:
120+
print(f"{tuplePackages}")
121+
122+
sys.exit(0)
123+

0 commit comments

Comments
 (0)