Skip to content

Commit 8f7d4bd

Browse files
committed
Adapting tests for computedValues attribute. We are now removing all None values before comparison.
1 parent 47a0047 commit 8f7d4bd

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

arango/formatter.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,18 @@ def format_collection(body: Json) -> Json:
217217
result["schema"] = body["schema"]
218218

219219
# New in 3.10
220-
if "computedValues" in body:
221-
result["computedValues"] = (
222-
[
223-
{
224-
"name": cv["name"],
225-
"expression": cv["expression"],
226-
"overwrite": cv["overwrite"],
227-
"computedOn": cv["computedOn"],
228-
"keepNull": cv["keepNull"],
229-
"failOnWarning": cv["failOnWarning"],
230-
}
231-
for cv in body["computedValues"]
232-
]
233-
if body.get("computedValues") is not None
234-
else None
235-
)
220+
if body.get("computedValues") is not None:
221+
result["computedValues"] = [
222+
{
223+
"name": cv["name"],
224+
"expression": cv["expression"],
225+
"overwrite": cv["overwrite"],
226+
"computedOn": cv["computedOn"],
227+
"keepNull": cv["keepNull"],
228+
"failOnWarning": cv["failOnWarning"],
229+
}
230+
for cv in body["computedValues"]
231+
]
236232
if "internalValidatorType" in body:
237233
result["internal_validator_type"] = body["internalValidatorType"]
238234

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ def mock_verify_format(body, result):
232232
body.pop("error", None)
233233
body.pop("code", None)
234234
result.pop("edge", None)
235+
236+
# Remove all None values
237+
# Sometimes they are expected to be excluded from the body (see computedValues)
238+
result = {k: v for k, v in result.items() if v is not None}
239+
body = {k: v for k, v in body.items() if v is not None}
240+
235241
if len(body) != len(result):
236242
before = sorted(body, key=lambda x: x.strip("_"))
237243
after = sorted(result, key=lambda x: x.strip("_"))

0 commit comments

Comments
 (0)