Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and jpmckinney committed Feb 18, 2025
1 parent a82cff8 commit fe7b95e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
1 change: 1 addition & 0 deletions nightingale/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def transform_row(
:param result: Existing result dictionary to update.
:return: Transformed row dictionary.
"""

# XXX: some duplication in code present maybe refactoring needed
def set_nested_value(nested_dict, keys, value, schema, add_new=False, append_once=False):
value = self.map_codelist_value(keys, schema, codelists, value)
Expand Down
23 changes: 6 additions & 17 deletions tests/test_unflatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ def get_ocid_mapping(self):
def get_containing_array_path(self, path):
return get_longest_array_path(self.array_paths, path)


@pytest.fixture(autouse=True)
def mock_load_workbook():
with mock.patch("openpyxl.load_workbook", return_value=mock.MagicMock()):
yield


@pytest.fixture
def mock_config():
datasource = Datasource(connection="sqlite:///:memory:")
Expand Down Expand Up @@ -301,7 +303,7 @@ def mock_config():
"col4": "val4",
"col5": "val5",
"col6": "val6",
"col7": "val7"
"col7": "val7",
},
MockMappingConfig(
{
Expand Down Expand Up @@ -332,25 +334,12 @@ def mock_config():
"lvl1": {
"field": "val1",
"array1": [
{
"id": "val4",
"field1": "val2",
"field2": "val3"
},
{"id": "val4", "field1": "val2", "field2": "val3"},
],
"lvl2": {
"field": "val5",
"array2": [
{
"id": "val7",
"field1": "val6"
}
]
}
"lvl2": {"field": "val5", "array2": [{"id": "val7", "field1": "val6"}]},
}
}
}
},
),
],
)
Expand Down

0 comments on commit fe7b95e

Please sign in to comment.