def test_simplist_expression(self): self.assertEqual([['name', 'A'], ['name']], p('name:"A" > name')) self.assertEqual([['name', 'A'], ['name']], p('name:"A"')) self.assertEqual([['name', 'A'], ['name']], p('"A"'))
def test_logical_expression(self): self.assertEqual([[['name', 'A'], '*', ['name', 'B']], ['name']], p('"A" * "B"')) self.assertEqual([[['name', 'A'], '+', ['name', 'B']], ['name']], p('"A" + "B"')) self.assertEqual([[['name', 'A'], '+', [['name', 'B'], '*', ['name', 'C']]], ['name']], p('"A" + "B" * "C"')) self.assertEqual([[[['name', 'A'], '+', ['name', 'B']], '*', ['name', 'C']], ['name']], p('("A" + "B") * "C"'))
def test_attr_expression(self): self.assertEqual((['name', 'A'], ['name', 'author'], []), p('name:"A" > name, author'))
def test_attr_expression(self): self.assertEqual([['name', 'A'], ['name', 'author']], p('name:"A" > name, author'))