コード例 #1
0
 def test_fill_empty5(self):
     selector = "a, - b & (d, )"
     ast = Node(
         ",", Leaf("a"),
         Node("&", Node("-", Leaf(""), Leaf("b")),
              Node(",", Leaf("d"), Leaf(""))))
     self.assertEqual(ast, build_ast(selector))
コード例 #2
0
 def test_complex1(self):
     selector = "align & enumerate itemize | list equation"
     ast = Node(
         "|",
         Node("&", Leaf("align"),
              Node(" ", Leaf("enumerate"), Leaf("itemize"))),
         Node(" ", Leaf("list"), Leaf("equation")))
     self.assertEqual(ast, build_ast(selector))
コード例 #3
0
 def test_complex3(self):
     selector = "a, b & (c | d e) - f g, h i & j k - (l | m n)"
     ast = Node(
         ",",
         Node(
             ",", Leaf("a"),
             Node(
                 "&", Leaf("b"),
                 Node("-",
                      Node("|", Leaf("c"), Node(" ", Leaf("d"), Leaf("e"))),
                      Node(" ", Leaf("f"), Leaf("g"))))),
         Node(
             "&", Node(" ", Leaf("h"), Leaf("i")),
             Node("-", Node(" ", Leaf("j"), Leaf("k")),
                  Node("|", Leaf("l"), Node(" ", Leaf("m"), Leaf("n"))))))
     self.assertEqual(ast, build_ast(selector))
コード例 #4
0
 def test_complex2(self):
     selector = "a, b - c, d - e f"
     ast = Node(",", Node(",", Leaf("a"), Node("-", Leaf("b"), Leaf("c"))),
                Node("-", Leaf("d"), Node(" ", Leaf("e"), Leaf("f"))))
     self.assertEqual(ast, build_ast(selector))
コード例 #5
0
 def test_fill_empty2(self):
     selector = "- (- b)"
     ast = Node("-", Leaf(""), Node("-", Leaf(""), Leaf("b")))
     self.assertEqual(ast, build_ast(selector))
コード例 #6
0
 def test_fill_empty4(self):
     selector = "a, &"
     ast = Node(",", Leaf("a"), Node("&", Leaf(""), Leaf("")))
     self.assertEqual(ast, build_ast(selector))
コード例 #7
0
 def test_fill_empty1(self):
     selector = "- test"
     ast = Node("-", Leaf(""), Leaf("test"))
     self.assertEqual(ast, build_ast(selector))
コード例 #8
0
 def test_nested_or(self):
     selector = "align | list equation"
     ast = Node("|", Leaf("align"), Node(" ", Leaf("list"),
                                         Leaf("equation")))
     self.assertEqual(ast, build_ast(selector))
コード例 #9
0
 def test_nested(self):
     selector = "list equation"
     ast = Node(" ", Leaf("list"), Leaf("equation"))
     self.assertEqual(ast, build_ast(selector))
コード例 #10
0
 def test_simple(self):
     selector = "equation"
     ast = Leaf("equation")
     self.assertEqual(ast, build_ast(selector))
コード例 #11
0
 def test_empty(self):
     selector = ""
     ast = Leaf("")
     self.assertEqual(ast, build_ast(selector))