Commit 2aeaf0de authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

new test failing transformation_factory with generic meta

parent efd94bc3
...@@ -26,7 +26,7 @@ sys.path.extend(['../', './']) ...@@ -26,7 +26,7 @@ sys.path.extend(['../', './'])
from DHParser.syntaxtree import parse_sxpr from DHParser.syntaxtree import parse_sxpr
from DHParser.transform import traverse, reduce_single_child, remove_whitespace, \ from DHParser.transform import traverse, reduce_single_child, remove_whitespace, \
traverse_locally, collapse, lstrip, rstrip, remove_content traverse_locally, collapse, lstrip, rstrip, remove_content, remove_tokens
class TestRemoval: class TestRemoval:
...@@ -79,6 +79,15 @@ class TestRemoval: ...@@ -79,6 +79,15 @@ class TestRemoval:
remove_content([cst], '#') remove_content([cst], '#')
assert cst.content == "facitergula" assert cst.content == "facitergula"
def test_remove_tokens(self):
cst = parse_sxpr('(wortarten (:Token "ajektiv") (:Token "et") (:Token "praeposition"))')
ast_table = {
"wortarten": [remove_tokens({"et"})],
"*": []
}
traverse(cst, ast_table)
print(cst.as_sxpr())
class TestConditionalTransformations: class TestConditionalTransformations:
"""Tests conditional transformations.""" """Tests conditional transformations."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment