Skip to content

Commit 53ce3da

Browse files
committed
fix test
1 parent 21d384c commit 53ce3da

1 file changed

Lines changed: 12 additions & 53 deletions

File tree

tests/unit/synapseclient/extensions/unit_test_create_json_schema.py

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,76 +1219,37 @@ def test_set_conditional_dependencies_nothing_added(
12191219
assert json_schema == {"allOf": []}
12201220

12211221

1222-
'''
12231222
@pytest.mark.parametrize(
1224-
"reverse_dependencies, valid_values_map, expected_schema",
1223+
"reverse_dependencies, valid_values_map, expected_conditional_dependencies",
12251224
[
12261225
(
12271226
{"CancerType": ["Cancer"]},
12281227
{"Cancer": ["Diagnosis"]},
1229-
JSONSchema(
1230-
all_of=[
1231-
{
1232-
"if": {"properties": {"Diagnosis": {"enum": ["Cancer"]}}},
1233-
"then": {
1234-
"properties": {"CancerType": {"not": {"type": "null"}}},
1235-
"required": ["CancerType"],
1236-
},
1237-
}
1238-
]
1239-
),
1228+
{("Diagnosis", "Cancer"): ["CancerType"]},
12401229
),
12411230
(
12421231
{"CancerType": ["Cancer"]},
12431232
{"Cancer": ["Diagnosis1", "Diagnosis2"]},
1244-
JSONSchema(
1245-
all_of=[
1246-
{
1247-
"if": {"properties": {"Diagnosis1": {"enum": ["Cancer"]}}},
1248-
"then": {
1249-
"properties": {"CancerType": {"not": {"type": "null"}}},
1250-
"required": ["CancerType"],
1251-
},
1252-
},
1253-
{
1254-
"if": {"properties": {"Diagnosis2": {"enum": ["Cancer"]}}},
1255-
"then": {
1256-
"properties": {"CancerType": {"not": {"type": "null"}}},
1257-
"required": ["CancerType"],
1258-
},
1259-
},
1260-
]
1261-
),
1233+
{
1234+
("Diagnosis1", "Cancer"): ["CancerType"],
1235+
("Diagnosis2", "Cancer"): ["CancerType"],
1236+
},
12621237
),
12631238
(
12641239
{"CancerType": ["Cancer1", "Cancer2"]},
12651240
{"Cancer1": ["Diagnosis1"], "Cancer2": ["Diagnosis2"]},
1266-
JSONSchema(
1267-
all_of=[
1268-
{
1269-
"if": {"properties": {"Diagnosis1": {"enum": ["Cancer1"]}}},
1270-
"then": {
1271-
"properties": {"CancerType": {"not": {"type": "null"}}},
1272-
"required": ["CancerType"],
1273-
},
1274-
},
1275-
{
1276-
"if": {"properties": {"Diagnosis2": {"enum": ["Cancer2"]}}},
1277-
"then": {
1278-
"properties": {"CancerType": {"not": {"type": "null"}}},
1279-
"required": ["CancerType"],
1280-
},
1281-
},
1282-
]
1283-
),
1241+
{
1242+
("Diagnosis1", "Cancer1"): ["CancerType"],
1243+
("Diagnosis2", "Cancer2"): ["CancerType"],
1244+
},
12841245
),
12851246
],
12861247
ids=["one rev dep, one enum", "two rev deps, one enum", "two rev deps, two enums"],
12871248
)
12881249
def test_set_conditional_dependencies(
12891250
reverse_dependencies: dict[str, list[str]],
12901251
valid_values_map: dict[str, list[str]],
1291-
expected_schema: JSONSchema,
1252+
expected_conditional_dependencies: dict[tuple[str, str], list[str]],
12921253
dmge: DataModelGraphExplorer,
12931254
) -> None:
12941255
"""Tests for _set_conditional_dependencies"""
@@ -1297,12 +1258,10 @@ def test_set_conditional_dependencies(
12971258
gts._reverse_dependencies = reverse_dependencies
12981259
gts._valid_values_map = valid_values_map
12991260
gts.current_node.name = "CancerType"
1300-
gts.current_node.display_name = "Cancer Type"
13011261
_set_conditional_dependencies(
13021262
json_schema=json_schema, graph_state=gts, use_display_labels=False
13031263
)
1304-
assert json_schema == expected_schema
1305-
'''
1264+
assert json_schema.conditional_dependencies == expected_conditional_dependencies
13061265

13071266

13081267
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)