Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotan committed Feb 5, 2025
1 parent 346053d commit cae14e5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
2 changes: 2 additions & 0 deletions test/ProfileManager2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6501,6 +6501,8 @@ def test_switchProfile_importMntGrp(self):
"data_type": types,
"synchronizer": {},
"synchronization": {},
"value_ref_enabled": {},
"value_ref_pattern": {},
"shape": shapes
}
)
Expand Down
2 changes: 2 additions & 0 deletions test/ProfileManager3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6507,6 +6507,8 @@ def test_switchProfile_importMntGrp(self):
"data_type": types,
"synchronizer": {},
"synchronization": {},
"value_ref_enabled": {},
"value_ref_pattern": {},
"shape": shapes
}
)
Expand Down
50 changes: 32 additions & 18 deletions test/ProfileManager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,15 +1843,16 @@ def compareToDumpJSON(self, el, excluded=None, name="default"):
w1 = json.loads(self.__dump[name][key])
w2 = json.loads(el[key])
except Exception:
# if self.__dump[name][key] != el[key]:
# print key
if self.__dump[name][key] != el[key]:
print(key)
self.assertEqual(self.__dump[name][key], el[key])
else:
if isinstance(w1, dict):
self.myAssertDict(w1, w2)
else:
# if self.__dump[name][key] != el[key]:
# print "COMP", key
if self.__dump[name][key] != el[key]:
if sys.version_info > (3,):
print("COMP", key)
self.assertEqual(self.__dump[name][key], el[key])

def getRandomName(self, maxsize):
Expand Down Expand Up @@ -1882,15 +1883,17 @@ def myAssertDict(self, dct, dct2):
logger.debug('dict %s' % type(dct))
logger.debug("\n%s\n%s" % (dct, dct2))
self.assertTrue(isinstance(dct, dict))
# if not isinstance(dct2, dict):
# print "NOT DICT", type(dct2), dct2
# print "DICT", type(dct), dct
if not isinstance(dct2, dict):
if sys.version_info > (3,):
print("NOT DICT", type(dct2), dct2)
print("DICT", type(dct), dct)
self.assertTrue(isinstance(dct2, dict))
logger.debug("%s %s" % (len(list(dct.keys())), len(list(dct2.keys()))))
# if set(dct.keys()) ^ set(dct2.keys()):
# print 'DCT', dct.keys()
# print 'DCT2', dct2.keys()
# print "DIFF", set(dct.keys()) ^ set(dct2.keys())
if set(dct.keys()) ^ set(dct2.keys()):
if sys.version_info > (3,):
print('DCT', dct.keys())
print('DCT2', dct2.keys())
print("DIFF", set(dct.keys()) ^ set(dct2.keys()))
self.assertEqual(len(list(dct.keys())), len(list(dct2.keys())))
for k, v in dct.items():
logger.debug("%s in %s" % (str(k), str(dct2.keys())))
Expand All @@ -1899,8 +1902,9 @@ def myAssertDict(self, dct, dct2):
self.myAssertDict(v, dct2[k])
else:
logger.debug("%s , %s" % (str(v), str(dct2[k])))
# if v != dct2[k]:
# print 'VALUES!! ', k, v, dct2[k]
if v != dct2[k]:
if sys.version_info > (3,):
print('VALUES!! ', k, v, dct2[k])
self.assertEqual(v, dct2[k])

def myCompDict(self, dct, dct2):
Expand Down Expand Up @@ -6656,6 +6660,8 @@ def test_switchProfile_importMntGrp(self):
"data_type": types,
"synchronizer": {},
"synchronization": {},
"value_ref_enabled": {},
"value_ref_pattern": {},
"shape": shapes
}
)
Expand Down Expand Up @@ -6961,11 +6967,13 @@ def test_switchProfile_importMntGrp(self):
self.myAssertRaise(Exception, lmgt.isMntGrpUpdated)

lmgt.switchProfile(False)

self.compareToDumpJSON(
lse, [
"DataSourceSelection",
"UnplottedComponents",
"PreselectingDataSources",
# "ChannelProperties",
"Timer"
],
name=mg1)
Expand All @@ -6974,10 +6982,6 @@ def test_switchProfile_importMntGrp(self):
ltmpcf = json.loads(lmgt.mntGrpConfiguration())
self.myAssertDict(tmpcf, ltmpcf)

self.assertEqual(
set(json.loads(lse["PreselectingDataSources"])),
set(aadss[mg1]))

# adtimers =
set(
json.loads(lse["Timer"])) - set(ltimers[mg1])
Expand Down Expand Up @@ -7020,6 +7024,7 @@ def test_switchProfile_importMntGrp(self):
se[mg2],
["DataSourceSelection",
"UnplottedComponents",
# "ChannelProperties",
"OrderedChannels", # IMPROVE
"PreselectingDataSources"],
name=mg2)
Expand All @@ -7036,6 +7041,7 @@ def test_switchProfile_importMntGrp(self):
["DataSourceSelection",
"UnplottedComponents",
"OrderedChannels", # IMPROVE
# "ChannelProperties",
"PreselectingDataSources",
"Timer",
"MntGrp"],
Expand Down Expand Up @@ -7200,6 +7206,7 @@ def test_switchProfile_importMntGrp(self):
"DataSourceSelection",
"UnplottedComponents",
"OrderedChannels", # IMPROVE
# "ChannelProperties",
"PreselectingDataSources",
"Timer",
"MntGrp"],
Expand All @@ -7213,7 +7220,7 @@ def test_switchProfile_importMntGrp(self):
"ComponentSelection",
"DataSourceSelection",
"UnplottedComponents",
"ChannelProperties",
# "ChannelProperties",
"PreselectingDataSources",
"Timer"],
name=mg2)
Expand Down Expand Up @@ -7289,6 +7296,7 @@ def test_switchProfile_importMntGrp(self):
[
"DataSourceSelection",
"UnplottedComponents",
# "ChannelProperties",
"PreselectingDataSources",
"Timer"],
name=mg3)
Expand Down Expand Up @@ -7338,6 +7346,7 @@ def test_switchProfile_importMntGrp(self):
"DataSourceSelection",
"UnplottedComponents",
"PreselectingDataSources",
# "ChannelProperties",
"Timer",
"MntGrp"],
name=mg3)
Expand Down Expand Up @@ -7402,6 +7411,7 @@ def test_switchProfile_importMntGrp(self):
[
"DataSourceSelection",
"UnplottedComponents",
# "ChannelProperties",
"PreselectingDataSources",
"Timer"],
name=mg3)
Expand Down Expand Up @@ -7452,6 +7462,7 @@ def test_switchProfile_importMntGrp(self):
lse,
[
"DataSourceSelection",
# "ChannelProperties",
"UnplottedComponents",
"PreselectingDataSources",
"Timer"],
Expand Down Expand Up @@ -7500,6 +7511,7 @@ def test_switchProfile_importMntGrp(self):
[
"DataSourceSelection",
"UnplottedComponents",
# "ChannelProperties",
"PreselectingDataSources",
"Timer"],
name=mg3)
Expand Down Expand Up @@ -7541,6 +7553,7 @@ def test_switchProfile_importMntGrp(self):
[
"DataSourceSelection",
"UnplottedComponents",
# "ChannelProperties",
"PreselectingDataSources",
"Timer", "MntGrp"],
name=mg3)
Expand Down Expand Up @@ -7595,6 +7608,7 @@ def test_switchProfile_importMntGrp(self):
"Timer",
"MntGrp",
"OrderedChannels",
# "ChannelProperties",
"ComponentSelection",
"DataSourceSelection",
"UnplottedComponents",
Expand Down

0 comments on commit cae14e5

Please sign in to comment.