def test_is_variation_between_nodes(self):
        variation = ast.WhitespaceVariation([
            ast.SequencePattern([PatternConstructor.build_node_desc('newline')]),
            ast.SequencePattern([PatternConstructor.build_node_desc('space'), PatternConstructor.build_node_desc('newline')])])
        root = ParseTreeConstructor.add_root_to_siblings('comment', 'newline', 'comment')
        present = self.matcher.is_variation_between_nodes(variation, root.value[0], root.value[2])
        assert present

        root = ParseTreeConstructor.add_root_to_siblings('comment', 'space', 'newline', 'comment')
        present = self.matcher.is_variation_between_nodes(variation, root.value[0], root.value[3])
        assert present
 def test_is_start_of_sequence(self):
     node_list = [PatternConstructor.build_node_desc('newline'), PatternConstructor.build_node_desc('space')]
     seq = ast.SequencePattern(node_list)
     root = ParseTreeConstructor.add_root_to_siblings('newline', 'space', 'space')
     is_match, nodes = self.matcher.is_start_of_sequence(seq, root.value[0])
     assert is_match
     assert len(nodes) == 1
 def setUp(self):
     self.matcher = matching.PatternMatcher(matching.Filter.EMPTY)
     self.tree = ParseTreeConstructor.add_root_to_siblings('ruleset', 'newline')
     ParseTreeConstructor.add_children_to_node('declaration', 'newline', 'declaration', 'space', 'declaration',
                                               node=self.tree.value[0])
     pass