Skip to content

Commit

Permalink
Merge pull request #205 from PowerGridModel/fix/new-version-substitut…
Browse files Browse the repository at this point in the history
…ion-status

add substitution
  • Loading branch information
mgovers authored Nov 29, 2023
2 parents 5b5a687 + 053fd7a commit 0452a53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/converters/tabular_converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ units:
substitutions:
".*Switch state":
"off": 0
"in": 1
"on": 1
```
Expand Down Expand Up @@ -162,6 +163,7 @@ substitutions:
".*Switch state":
"off": 0
"in": 1
"on": 1
N1:
none: false
own: true
Expand Down
2 changes: 2 additions & 0 deletions src/power_grid_model_io/config/excel/vision_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,11 @@ substitutions:
".*Switch state":
"off": 0
"in": 1
"on": 1
"Switch state .*":
"off": 0
"in": 1
"on": 1
N1:
0: false
1: true
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/mappings/test_value_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def mapping() -> ValueMapping:
return ValueMapping(
{
"sources.closed": {"yes": 1, "no": 0},
".*_switch_state": {"off": 0, "in": 1},
".*_switch_state": {"off": 0, "in": 1, "on": 1},
"N1": {"none": False, "own": True},
}
)
Expand All @@ -30,7 +30,7 @@ def test_get_substitutions__exact_match_with_table(mapping: ValueMapping):


def test_get_substitutions__regex_match(mapping: ValueMapping):
assert mapping.get_substitutions("from_switch_state") == {"off": 0, "in": 1}
assert mapping.get_substitutions("from_switch_state") == {"off": 0, "in": 1, "on": 1}


def test_get_substitutions__no_match(mapping: ValueMapping):
Expand Down

0 comments on commit 0452a53

Please sign in to comment.