Skip to content

Commit

Permalink
Merge branch 'main' into fix/empty-array-remove
Browse files Browse the repository at this point in the history
  • Loading branch information
nitbharambe authored Jul 25, 2024
2 parents ad51a78 + c89d49a commit 8997e18
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test-and-sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
python: ["3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python: "3.9"
python: "3.10"
fail-fast: false
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -131,10 +131,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
python: ["3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python: "3.9"
python: "3.10"
fail-fast: false
runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sphinx:
build:
os: "ubuntu-20.04"
tools:
python: "3.9"
python: "3.10"
jobs:
post_install:
# Build package with doc requirements from pyproject.optional-dependencies
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers=[
"Operating System :: MacOS",
"Topic :: Scientific/Engineering :: Physics",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"numpy>=1.20",
"openpyxl",
Expand Down Expand Up @@ -84,7 +84,7 @@ addopts = ["--cov=power_grid_model_io", "--cov-report=term", "--cov-report=html:

[tool.black]
line-length = 120
target-version = ["py39", "py310", "py311"]
target-version = ["py310", "py311"]

[tool.isort]
profile = "black"
Expand Down
2 changes: 2 additions & 0 deletions src/power_grid_model_io/converters/tabular_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ def auto_id(row: np.ndarray):

return pgm_id

if col_data.empty:
return col_data
return col_data.apply(auto_id, axis=1, raw=True)

def _parse_pandas_function(
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/converters/test_tabular_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,22 @@ def test_parse_auto_id__invalid_key_definition(
)


@patch("power_grid_model_io.converters.tabular_converter.TabularConverter._get_id")
def test_parse_auto_id__empty_col_data(
mock_get_id: MagicMock, converter: TabularConverter, tabular_data_no_units_no_substitutions: TabularData
):
converter._parse_auto_id(
data=tabular_data_no_units_no_substitutions,
table="lines",
ref_table=None,
ref_name=None,
key_col_def={"id": "id_number", "node": "from_node_side"},
table_mask=np.array([False, False]),
extra_info={},
)
mock_get_id.assert_not_called()


@pytest.mark.parametrize(
("function", "expected"),
[
Expand Down

0 comments on commit 8997e18

Please sign in to comment.