Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPeczek-Roboflow committed Jan 7, 2025
1 parent 1d15396 commit b858114
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 14 additions & 4 deletions tests/inference/unit_tests/core/test_roboflow_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,9 @@ def test_get_workflow_specification_when_connection_error_occurs_but_file_is_cac
get_mock.return_value = MagicMock(
status_code=200,
json=MagicMock(
return_value={"workflow": {"config": json.dumps({"specification": {"some": "some"}})}}
return_value={
"workflow": {"config": json.dumps({"specification": {"some": "some"}})}
}
),
)
_ = get_workflow_specification(
Expand All @@ -1744,7 +1746,10 @@ def test_get_workflow_specification_when_connection_error_occurs_but_file_is_cac
)

# then
assert result == {"some": "some", "id": None}, "Expected workflow specification to be retrieved from file"
assert result == {
"some": "some",
"id": None,
}, "Expected workflow specification to be retrieved from file"


@mock.patch.object(roboflow_api.requests, "get")
Expand All @@ -1760,7 +1765,9 @@ def test_get_workflow_specification_when_consecutive_request_hits_ephemeral_cach
get_mock.return_value = MagicMock(
status_code=200,
json=MagicMock(
return_value={"workflow": {"config": json.dumps({"specification": {"some": "some"}})}}
return_value={
"workflow": {"config": json.dumps({"specification": {"some": "some"}})}
}
),
)
ephemeral_cache = MemoryCache()
Expand All @@ -1780,7 +1787,10 @@ def test_get_workflow_specification_when_consecutive_request_hits_ephemeral_cach
)

# then
assert result == {"some": "some", "id": None}, "Expected workflow specification to be retrieved from file"
assert result == {
"some": "some",
"id": None,
}, "Expected workflow specification to be retrieved from file"
assert get_mock.call_count == 1, "Expected remote API to be only called once"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ def test_validate_runtime_input_when_input_is_valid() -> None:
type="ClipComparison",
name="a",
image="$inputs.image",
text="$inputs.text_1",
texts="$inputs.text_1",
),
manifest_property="text",
manifest_property="texts",
),
InputSubstitution(
input_parameter_name="text_2",
step_manifest=BlockManifest(
type="ClipComparison",
name="a",
image="$inputs.image",
text="$inputs.text_2",
texts="$inputs.text_2",
),
manifest_property="text",
manifest_property="texts",
),
]

Expand Down

0 comments on commit b858114

Please sign in to comment.