[OASIS] repeated property keys should be merged, not overwritten

This commit is contained in:
Jan Petykiewicz 2026-03-31 19:00:38 -07:00
commit 08421d6a54
2 changed files with 20 additions and 1 deletions

View file

@ -714,7 +714,7 @@ def properties_to_annotations(
string = repr(value)
logger.warning(f'Converting property value for key ({key}) to string ({string})')
values.append(string)
annotations[key] = values
annotations.setdefault(key, []).extend(values)
return annotations

View file

@ -4,6 +4,8 @@ from numpy.testing import assert_equal
from ..pattern import Pattern
from ..library import Library
def test_oasis_roundtrip(tmp_path: Path) -> None:
# Skip if fatamorgana is not installed
pytest.importorskip("fatamorgana")
@ -23,3 +25,20 @@ def test_oasis_roundtrip(tmp_path: Path) -> None:
# Check bounds
assert_equal(read_lib["cell1"].get_bounds(), [[0, 0], [10, 10]])
def test_oasis_properties_to_annotations_merges_repeated_keys() -> None:
pytest.importorskip("fatamorgana")
import fatamorgana.records as fatrec
from ..file.oasis import properties_to_annotations
annotations = properties_to_annotations(
[
fatrec.Property("k", [1], is_standard=False),
fatrec.Property("k", [2, 3], is_standard=False),
],
{},
{},
)
assert annotations == {"k": [1, 2, 3]}