Skip to content

Commit

Permalink
format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Jul 13, 2023
1 parent bafba75 commit a928c1d
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions cellpack/tests/test_recipe_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,32 @@ def test_sanitize_format_version(expected_result, input_recipe_data):
}


def test_get_grad_and_obj():
obj_data = downloaded_data_from_firebase["composition"]["membrane"]["regions"][
"interior"
][0]["object"]
obj_dict = {
"peroxisome": {
"gradient": {
"mode": "surface",
"name": "nucleus_surface_gradient",
},
"name": "peroxisome",
}
}
grad_dict = {}
obj_dict, grad_dict = RecipeLoader._get_grad_and_obj(obj_data, obj_dict, grad_dict)
assert obj_dict == {
"peroxisome": {"gradient": "nucleus_surface_gradient", "name": "peroxisome"}
}
assert grad_dict == {
"nucleus_surface_gradient": {
"mode": "surface",
"name": "nucleus_surface_gradient",
}
}


@pytest.fixture
def sort_data_from_composition():
return RecipeLoader._collect_and_sort_data(
Expand All @@ -254,33 +280,3 @@ def test_compile_recipe_from_firebase(sort_data_from_composition):
downloaded_data_from_firebase, objects, gradients, composition
)
assert compiled_recipe == compiled_firebase_recipe_example


def test_get_grad_and_obj():
obj_data = {
"gradient": {
"mode": "surface",
"name": "nucleus_surface_gradient",
},
"name": "peroxisome",
}
obj_dict = {
"peroxisome": {
"gradient": {
"mode": "surface",
"name": "nucleus_surface_gradient",
},
"name": "peroxisome",
}
}
grad_dict = {}
obj_dict, grad_dict = RecipeLoader._get_grad_and_obj(obj_data, obj_dict, grad_dict)
assert obj_dict == {
"peroxisome": {"gradient": "nucleus_surface_gradient", "name": "peroxisome"}
}
assert grad_dict == {
"nucleus_surface_gradient": {
"mode": "surface",
"name": "nucleus_surface_gradient",
}
}

0 comments on commit a928c1d

Please sign in to comment.