Skip to content

Commit

Permalink
Include dict (#361)
Browse files Browse the repository at this point in the history
* Add what is required to export dictionaries

* Add what is required to export dictionaries

* Add some dictionary tests

* Make more tests for dictionaries

* Add docstring

* Change naming of class and go for JSON as only format

* Lint

* Change docstring

* Add  in class enum

* add  as an allowed content

* lint

---------

Co-authored-by: Daniel Berge Sollien <[email protected]>
  • Loading branch information
adnejacobsen and daniel-sol authored Sep 7, 2023
1 parent 517c71d commit b2b909c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion schema/definitions/0.8.0/schema/fmu_results.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"polygons",
"cube",
"well",
"points"
"points",
"dictionary"
]
},
"source": {
Expand Down
1 change: 1 addition & 0 deletions src/fmu/dataio/_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __post_init__(self):
"khproduct": None,
"timeseries": None,
"wellpicks": None,
"parameters": None,
}

STANDARD_TABLE_INDEX_COLUMNS = {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_units/test_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_export_dict_w_meta(globalconfig2, dictionary, request):
name = dictionary
in_dict = request.getfixturevalue(dictionary)
print(f"{name}: {in_dict}")
exd = ExportData(config=globalconfig2)
exd = ExportData(config=globalconfig2, content="parameters")
out_dict, out_meta = read_dict_and_meta(exd.export(in_dict, name=name))
assert in_dict == out_dict
assert_dict_correct(out_dict, out_meta, name)
Expand All @@ -131,7 +131,7 @@ def test_invalid_dict(globalconfig2, drogon_summary, drogon_volumes):
drogon_volumes (pa.Table): a pyarrow table
"""
in_dict = {"volumes": drogon_volumes, "summary": drogon_summary}
exd = ExportData(config=globalconfig2)
exd = ExportData(config=globalconfig2, content="parameters")
with pytest.raises(TypeError) as exc_info:
print(exc_info)
exd.export(in_dict, name="invalid")
Expand Down

0 comments on commit b2b909c

Please sign in to comment.