Skip to content

Commit

Permalink
Apply lint fixes in catalog/
Browse files Browse the repository at this point in the history
  • Loading branch information
krysal committed Dec 2, 2024
1 parent def700b commit 443bf83
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
7 changes: 4 additions & 3 deletions catalog/tests/dags/data_refresh/test_alter_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ def test_alter_data_batch():
(51, "bbb", True),
(52, "ccc", False),
]
with mock.patch("data_refresh.alter_data.PostgresHook") as HookMock, mock.patch(
"data_refresh.alter_data.generate_tag_updates"
) as tag_updates_mock:
with (
mock.patch("data_refresh.alter_data.PostgresHook") as HookMock,
mock.patch("data_refresh.alter_data.generate_tag_updates") as tag_updates_mock,
):
mock_pg = HookMock.return_value
mock_pg.run.return_value = sample_data
mock_cursor = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def image_data():


def test__get_initial_query_params():
with patch.object(pp, "get_response_json", return_value={}), pytest.raises(
Exception
with (
patch.object(pp, "get_response_json", return_value={}),
pytest.raises(Exception),
):
pp._get_initial_query_params()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,25 @@ def test_alert_new_unit_codes():
def test_validate_unit_codes_from_api_raises_exception(
new_unit_codes, outdated_unit_codes
):
with patch.object(ingester, "_get_unit_codes_from_api"), patch.object(
ingester,
"_get_new_and_outdated_unit_codes",
return_value=(new_unit_codes, outdated_unit_codes),
with (
patch.object(ingester, "_get_unit_codes_from_api"),
patch.object(
ingester,
"_get_new_and_outdated_unit_codes",
return_value=(new_unit_codes, outdated_unit_codes),
),
):
message = "^\n\\*Updates needed to the SMITHSONIAN_SUB_PROVIDERS dictionary\\**"
with pytest.raises(AirflowException, match=message):
ingester.validate_unit_codes_from_api()


def test_validate_unit_codes_from_api():
with patch.object(ingester, "_get_unit_codes_from_api"), patch.object(
ingester, "_get_new_and_outdated_unit_codes", return_value=(set(), set())
with (
patch.object(ingester, "_get_unit_codes_from_api"),
patch.object(
ingester, "_get_new_and_outdated_unit_codes", return_value=(set(), set())
),
):
# Validation should run without raising an exception
ingester.validate_unit_codes_from_api()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def test_generate_markdown_doc(props_source_mock):
preamble_mock = "Preamble Content"
postamble_mock = "Postamble Content"

with patch(f"{MODULE}.PREAMBLE", preamble_mock), patch(
f"{MODULE}.POSTAMBLE", postamble_mock
with (
patch(f"{MODULE}.PREAMBLE", preamble_mock),
patch(f"{MODULE}.POSTAMBLE", postamble_mock),
):
result = generate_markdown_doc()

Expand Down

0 comments on commit 443bf83

Please sign in to comment.