Skip to content

Commit

Permalink
Adds allow_bson=True to jsanitize invocation in contains_job_or_flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgalcode committed Jul 21, 2023
1 parent 08dc070 commit d3fa86f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jobflow/utils/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def contains_flow_or_job(obj: Any) -> bool:
# argument is a primitive, we won't find an flow or job here
return False

obj = jsanitize(obj, strict=True)
obj = jsanitize(obj, strict=True, allow_bson=True)

# recursively find any reference classes
locations = find_key_value(obj, "@class", "Flow")
Expand Down
3 changes: 3 additions & 0 deletions tests/utils/test_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def test_update_in_dictionary():


def test_contains_job_or_flow():
from datetime import datetime

from jobflow import Flow, Job
from jobflow.utils import contains_flow_or_job

Expand All @@ -74,3 +76,4 @@ def test_contains_job_or_flow():
assert contains_flow_or_job([[job]]) is True
assert contains_flow_or_job({"a": job}) is True
assert contains_flow_or_job({"a": [job]}) is True
assert contains_flow_or_job({"a": [job], "b": datetime.now()}) is True

0 comments on commit d3fa86f

Please sign in to comment.