diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2020-02-16 19:35:47 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2020-02-16 19:40:35 -0300 |
commit | 3a8cc83cbe465b798647b92357eff2d52454f3dc (patch) | |
tree | e437768b93e06c807387dab9b7fa3da6aec360ad /testing/test_examples.py | |
parent | f84c60e039864af593f6b8d015b11113a6e59f50 (diff) |
Squashed commit of the following:
* Move things around a bit more * Add project structure details to HACKING.md * Create setup.py * Split off A Boneless Datastructure Language
Diffstat (limited to 'testing/test_examples.py')
-rw-r--r-- | testing/test_examples.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/testing/test_examples.py b/testing/test_examples.py deleted file mode 100644 index 02532cc..0000000 --- a/testing/test_examples.py +++ /dev/null @@ -1,26 +0,0 @@ -import abdl - -def test_basic_example(): - m = next(abdl.match("->X:?$dict->Y", {"foo": 1, "bar": {"baz": 2}}, {'dict': dict})) - assert m['X'][0] == 'bar' - assert m['Y'][0] == 'baz' - assert m['Y'][1] == 2 - -def test_basic_2(): - m = next(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" - assert m['U'][0] == "https://soniex2.autistic.space/git-repos/ganarchy.git" - assert m['B'][0] == "HEAD" - assert m['B'][1] == {"active": True} - -def test_spaces(): - pat = abdl.compile("""-> 'projects'? - -> commit /[0-9a-fA-F]{40}|[0-9a-fA-F]{64}/? :?$dict - -> url :?$dict - -> branch :?$dict""", {'dict': dict}) - data = {"projects": {"385e734a52e13949a7a5c71827f6de920dbfea43": {"https://soniex2.autistic.space/git-repos/ganarchy.git": {"HEAD": {"active": True}}}}} - m = next(pat.match(data)) - assert m['commit'][0] == "385e734a52e13949a7a5c71827f6de920dbfea43" - assert m['url'][0] == "https://soniex2.autistic.space/git-repos/ganarchy.git" - assert m['branch'][0] == "HEAD" - assert m['branch'][1] == {"active": True} |