示例#1
0
 def assertContainsNode(self, node: MatchableNode, match_str: str, msg=None):
     try:
         node.match(match_str)
     except:
         if msg is None:
             msg = "{} doesn't contain {}".format(node, match_str)
         print("Actual node contents are:")
         print_tree(node)
         raise AssertionError(msg)
示例#2
0
    def wrapper(self, *args, **kwargs):
        """ The wrapper

        """
        root_node = parse_string(f.__doc__).get_tree()
        try:
            f(self, root_node, *args, **kwargs)
        except:
            print_tree(root_node)
            raise
示例#3
0
 def wrapper(self, *args, **kwargs):
     root_node = parse_string(f.__doc__).get_tree()
     root_node_t = transformer.transform(root_node)
     class_ = root_node_t["CLASS"]
     lines_seg = class_.compile()
     lines = [l[0] for l in lines_seg.lines]
     try:
         f(self, lines, *args, **kwargs)
     except:
         print_tree(root_node_t)
         raise
示例#4
0
 def wrapper(self, *args, **kwargs):
     root_node = parse_string(f.__doc__).get_tree()
     root_node_t = transformer.transform(root_node)
     body_block = root_node_t.match("FUNCTION|body/BLOCK")
     try:
         lines_seg = body_block.compile()
     except:
         print_tree(root_node)
         print("------------------")
         print_tree(root_node_t)
         raise
     lines = [l[0] for l in lines_seg.lines[1:]]
     f(self, lines, *args, **kwargs)
示例#5
0
 def wrapper(self, *args, **kwargs):
     root_node = parse_string(f.__doc__).get_tree()
     try:
         root_node_t = transformer.transform(root_node)
     except:
         print_tree(root_node)
         raise
     try:
         f(self, root_node_t, *args, **kwargs)
     except:
         print_tree(root_node)
         print("------------------")
         print_tree(root_node_t)
         raise