diff options
Diffstat (limited to 'testing/test_abdl.py')
-rw-r--r-- | testing/test_abdl.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/testing/test_abdl.py b/testing/test_abdl.py index d28658a..79a0edf 100644 --- a/testing/test_abdl.py +++ b/testing/test_abdl.py @@ -262,6 +262,13 @@ def test_empty(foo, pat): yield {} assert all(LogAndCompare(pat.match(foo), deep(foo))) +def test_optional_value_subtree(): + pat = abdl.compile("(->foo'foo'?)?(->bar'bar')") + matcher = pat.match({'foo': 1, 'bar': 2}) + assert list(matcher) == [{'foo': ('foo', 1), 'bar': ('bar', 2)}] + matcher = pat.match({'bar': 2}) + assert list(matcher) == [{'bar': ('bar', 2)}] + # FIXME #@hypothesis.given(objtree, st.text()) #def test_exhaustive(foo, pat): |