Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/allotropy/allotrope/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"^": "_CARET_",
"=": "_EQUALS_",
"@": "_AT_",
"'": "_QUOTE_",
# NOTE: this MUST be at the end, or it will break other key replacements.
" ": "_",
}
Expand Down
6 changes: 3 additions & 3 deletions tests/allotrope/converter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def test_custom_information_document() -> None:
cycle_threshold_value_setting=TQuantityValueUnitless(value=1.0),
),
),
{"extra key": "Value", "weird-key/(value)°": "Other value"},
{"extra key": "Value", "$w.e\\ir:[d]-k'e~y/(v^a=l@ue)°#": "Other value"},
)

assert item.custom_information_document.extra_key == "Value" # type: ignore
assert item.custom_information_document.weird_DASH_key_SLASH__OPAREN_value_CPAREN__DEG_ == "Other value" # type: ignore
assert item.custom_information_document._DOLLAR_w_POINT_e_BSLASH_ir_COLON__OBRACKET_d_CBRACKET__DASH_k_QUOTE_e_TILDE_y_SLASH__OPAREN_v_CARET_a_EQUALS_l_AT_ue_CPAREN__DEG__NUMBER_ == "Other value" # type: ignore
asm_dict = unstructure(item)
assert asm_dict == {
"cycle threshold result": {"value": None, "unit": "(unitless)"},
Expand All @@ -148,7 +148,7 @@ def test_custom_information_document() -> None:
},
"custom information document": {
"extra key": "Value",
"weird-key/(value)°": "Other value",
"$w.e\\ir:[d]-k'e~y/(v^a=l@ue)°#": "Other value",
},
}
assert structure(asm_dict, ProcessedDataDocumentItem) == item
Expand Down
Loading