Skip to content

Commit 39bdb5c

Browse files
fix(docs): clarify properties key naming in documentation and tests
- Updated documentation to replace "key" with "id" in the context of component properties in `system.yml`. - Adjusted test assertions to reflect the change from "key" to "id" for consistency with the updated documentation. - Ensured that error messages for duplicate properties also refer to "id" instead of "key".
1 parent 1c9dc49 commit 39bdb5c

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All notable changes to GemsPy are documented here.
66

77
### Added
88

9-
- **System components: `properties`** - introduces optional `properties` on components in `system.yml` (a list of `id`/`value` pairs). These are normalized into a `dict[str, str]` on the resolved `Component` (duplicate keys raise a `ValueError`).
9+
- **System components: `properties`** - introduces optional `properties` on components in `system.yml` (a list of `id`/`value` pairs). These are normalized into a `dict[str, str]` on the resolved `Component` (duplicate ids raise a `ValueError`).
1010
- **Model schema: `taxonomy-category`** - introduces optional `taxonomy-category` on models in library YAML files, exposed as `ModelSchema.taxonomy_category`.
1111

1212
## [0.1.0] - 2026-04-30

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ system:
9494
- id: G1
9595
model: basic.generator
9696
properties:
97-
- key: technology
97+
- id: technology
9898
value: nuclear
9999
parameters:
100100
- id: marginal_cost

docs/user-guide/inputs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ parts of the study from in-memory data.
4444
## System YAML: optional component `properties`
4545

4646
In `system.yml`, each component may define an optional `properties` section as a
47-
list of key/value pairs:
47+
list of id/value pairs:
4848

4949
~~~ yaml
5050
system:
@@ -59,7 +59,7 @@ system:
5959
~~~
6060

6161
At resolution time (`resolve_system` / `load_study`), this list is normalized into
62-
a `dict[str, str]` stored on the resolved `Component`. Duplicate keys are rejected.
62+
a `dict[str, str]` stored on the resolved `Component`. Duplicate ids are rejected.
6363

6464
### Loading the library and the system
6565

tests/unittests/system_parsing/test_components_parsing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def test_parse_yaml_components_properties_optional_and_normalized() -> None:
124124
raw = props_by_id["nuclear_1"]
125125
assert isinstance(raw, list) and len(raw) == 2
126126
assert [p.model_dump() for p in raw] == [
127-
{"key": "technology", "value": "nuclear"},
128-
{"key": "company", "value": "rhonepower"},
127+
{"id": "technology", "value": "nuclear"},
128+
{"id": "company", "value": "rhonepower"},
129129
]
130130

131131

@@ -174,7 +174,7 @@ def test_resolve_component_properties_duplicate_keys_raises(
174174
) -> None:
175175
system = parse_yaml_components(io.StringIO(_SYSTEM_WITH_PROPERTIES_DUPLICATE_KEYS))
176176
lib_dict = resolve_library([input_library])
177-
with pytest.raises(ValueError, match="duplicate properties key"):
177+
with pytest.raises(ValueError, match="duplicate properties id"):
178178
resolve_system(system, lib_dict)
179179

180180

tests/unittests/system_parsing/test_systemschema_from_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def test_parse_yaml_components_from_file_parses_properties_list(tmp_path: Path)
1818
- id: nuclear_1
1919
model: basic.generator
2020
properties:
21-
- key: technology
21+
- id: technology
2222
value: nuclear
23-
- key: company
23+
- id: company
2424
value: rhonepower
2525
"""
2626
p = tmp_path / "system.yml"
@@ -31,8 +31,8 @@ def test_parse_yaml_components_from_file_parses_properties_list(tmp_path: Path)
3131
assert comp.id == "nuclear_1"
3232
assert comp.properties is not None
3333
assert [x.model_dump() for x in comp.properties] == [
34-
{"key": "technology", "value": "nuclear"},
35-
{"key": "company", "value": "rhonepower"},
34+
{"id": "technology", "value": "nuclear"},
35+
{"id": "company", "value": "rhonepower"},
3636
]
3737

3838

0 commit comments

Comments
 (0)