diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-11-10 20:34:54 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-11-10 20:34:54 -0300 |
commit | 3d877ec7a5a832babbcb8ba384f2e7546a9c3401 (patch) | |
tree | f66baee4da5bd8e67551326aff2f5193da88c51c /testing/test_examples.py | |
parent | 7b150a2a1932546b4a8d92ef94bc96ee6efff4da (diff) |
Add some tests
Diffstat (limited to 'testing/test_examples.py')
-rw-r--r-- | testing/test_examples.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/test_examples.py b/testing/test_examples.py new file mode 100644 index 0000000..7341341 --- /dev/null +++ b/testing/test_examples.py @@ -0,0 +1,9 @@ +import abdl + +def test_basic_example(): + for m in abdl.match("->X:?$dict->Y", {"foo": 1, "bar": {"baz": 2}}, {'dict': dict}): + assert m['X'][0] == 'bar' and m['Y'][0] == 'baz' and m['Y'][1] == 2 + +def test_basic_2(): + for m in abdl.match("->'projects':?$d->P/[0-9a-fA-F]{40}|[0-9a-fA-F]{64}/?:?$d->U:?$d->B", {"projects": {"385e734a52e13949a7a5c71827f6de920dbfea43": {"https://soniex2.autistic.space/git-repos/ganarchy.git": {"HEAD": {"active": True}}}}}, {'d': dict}): + assert m['P'][0] == "385e734a52e13949a7a5c71827f6de920dbfea43" and m['U'][0] == "https://soniex2.autistic.space/git-repos/ganarchy.git" and m['B'][0] == "HEAD" and m['B'][1] == {"active": True} |