In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

test_compile.py 1.59 KB
Newer Older
eckhart's avatar
mend  
eckhart committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/bin/python3

"""test_compile.py - unit tests for the compile-module of DHParser

Author: Eckhart Arnold <arnold@badw.de>

Copyright 2017 Bavarian Academy of Sciences and Humanities

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

eckhart's avatar
eckhart committed
22 23 24
import sys

sys.path.extend(['../', './'])
eckhart's avatar
mend  
eckhart committed
25

26
from DHParser import parse_sxpr, Compiler
eckhart's avatar
mend  
eckhart committed
27 28


eckhart's avatar
eckhart committed
29 30 31 32
# class TestCompilerClass:
#     def test_error_propagations(self):
#         tree = parse_sxpr('(A (B 1) (C (D (E 2) (F 3))))')
#         A = tree
33 34 35
#         B = next(tree.select_if(lambda node: str(node) == "1"))
#         D = next(tree.select_if(lambda node: node.parser.name == "D"))
#         F = next(tree.select_if(lambda node: str(node) == "3"))
eckhart's avatar
eckhart committed
36 37
#         B.new_error("Error in child node")
#         F.new_error("Error in child's child node")
eckhart's avatar
eckhart committed
38 39 40 41 42
#         Compiler.propagate_error_flags(tree, lazy=True)
#         assert A.error_flag
#         assert not D.error_flag
#         Compiler.propagate_error_flags(tree, lazy=False)
#         assert D.error_flag
eckhart's avatar
mend  
eckhart committed
43 44 45 46 47 48


if __name__ == "__main__":
    from DHParser.testing import runner
    from DHParser.log import logging
    with logging(False):
eckhart's avatar
eckhart committed
49
        runner("", globals())