Skip to content

Commit

Permalink
check that AsdfNode is not JSON serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Jan 12, 2024
1 parent b6884f3 commit e74e963
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions asdf/_tests/test_lazy_nodes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import collections
import copy
import json
import weakref

import numpy as np
Expand Down Expand Up @@ -110,6 +111,19 @@ def test_copy(node, copy_operation):
assert copied_node == node


@pytest.mark.parametrize(
"node",
[
_lazy_nodes.AsdfDictNode({"a": 1, "b": 2}),
_lazy_nodes.AsdfListNode([1, 2, 3]),
_lazy_nodes.AsdfOrderedDictNode({"a": 1, "b": 2}),
],
)
def test_json_serialization(node):
with pytest.raises(TypeError, match="is not JSON serializable"):
json.dumps(node)


def test_cache_clear_on_close(tmp_path):
fn = tmp_path / "test.asdf"

Expand Down

0 comments on commit e74e963

Please sign in to comment.