Skip to content

Commit

Permalink
test: validate that named tuples error
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Nov 3, 2021
1 parent 8df27d1 commit c757370
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/python/tests-py/test_jsonschema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import namedtuple
from contextlib import suppress
from functools import partial

Expand Down Expand Up @@ -87,6 +88,14 @@ def test_array_tuple_invalid(val):
validate(schema, val)


def test_named_tuple():
Person = namedtuple("Person", "first_name last_name")
person_a = Person("Joe", "Smith")
schema = {"type": "array", "items": {"type": "string"}}
with pytest.raises(ValueError):
validate(schema, person_a)


def test_recursive_dict():
instance = {}
instance["foo"] = instance
Expand Down

0 comments on commit c757370

Please sign in to comment.