diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2020-11-06 21:03:04 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2020-11-06 21:05:25 -0300 |
commit | 436939628ff1c5bbc37d5c91c4a7c68d83f12f49 (patch) | |
tree | 6930fb0cb46774c79845956a98aee7760504a208 /testing | |
parent | fa55f672dfe9e20cadfef5b4ac8bb14a691277f8 (diff) |
Add optional subvalues
Diffstat (limited to 'testing')
-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): |