Skip to content

Commit 7ab3ddf

Browse files
Ryan CaliRyan Cali
authored andcommitted
Updated tests, accounting for duplicate key names
1 parent 70f15ee commit 7ab3ddf

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

pydra/engine/tests/test_task.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -998,22 +998,29 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
998998
funky.cache_dir = tmpdir
999999
funky()
10001000
message_path = tmpdir / funky.checksum / "messages"
1001+
print(message_path)
10011002
# go through each jsonld file in message_path and check if the label field exists
10021003
json_content = []
10031004

10041005
for file in glob(str(message_path) + "/*.jsonld"):
10051006
with open(file, "r") as f:
10061007
data = json.load(f)
1007-
print(data)
1008-
if "Activity_Label" in data:
1009-
json_content.append(True)
1010-
assert data["Activity_Label"] == "testfunc"
1011-
if "Entity_Label" in data:
1012-
assert data["Entity_Label"] == None
1008+
if "@type" in data:
1009+
if "AssociatedWith" in data:
1010+
assert "testfunc" in data["Label"]
1011+
1012+
1013+
1014+
if "@type" in data:
1015+
if data["@type"] == "input":
1016+
assert None == data["Label"]
1017+
1018+
#assert data["Type"] == "input"
1019+
10131020
if "AssociatedWith" in data:
10141021
assert None == data["AssociatedWith"]
10151022

1016-
assert any(json_content)
1023+
# assert any(json_content)
10171024

10181025

10191026
def test_audit_shellcommandtask(tmpdir):
@@ -1032,21 +1039,29 @@ def test_audit_shellcommandtask(tmpdir):
10321039
shelly()
10331040
message_path = tmpdir / shelly.checksum / "messages"
10341041
# go through each jsonld file in message_path and check if the label field exists
1035-
label_content = []
1042+
10361043
command_content = []
10371044

10381045
for file in glob(str(message_path) + "/*.jsonld"):
10391046
with open(file, "r") as f:
10401047
data = json.load(f)
1041-
print(data)
1042-
if "Activity_Label" in data:
1043-
label_content.append(True)
1048+
if "@type" in data:
1049+
if "AssociatedWith" in data:
1050+
assert "shelly" in data["Label"]
1051+
1052+
1053+
1054+
if "@type" in data:
1055+
if data["@type"] == "input":
1056+
assert None == data["Label"]
1057+
1058+
10441059
if "Command" in data:
10451060
command_content.append(True)
10461061
assert "ls -l" == data["Command"]
10471062

1048-
print(command_content)
1049-
assert any(label_content)
1063+
1064+
assert any(command_content)
10501065

10511066

10521067
def test_audit_shellcommandtask_version(tmpdir):

0 commit comments

Comments
 (0)