Exemplo n.º 1
0
 def test_context_item2(self):
     """test context item (disabled) for the initial expression"""
     xpb = XPathBuilder(context_item=False)
     xp1 = xpb.foo.bar
     xp1_exp = '/foo/bar'
     xp2 = xpb.context(True).foo.bar
     xp2_exp = './foo/bar'
     self.assertEqual(xp1.tostring(), xp1_exp)
     self.assertEqual(xp2.tostring(), xp2_exp)
     self.assertFalse(xpb.context_item)
Exemplo n.º 2
0
 def test_context_item2(self):
     """test context item (disabled) for the initial expression"""
     xpb = XPathBuilder(context_item=False)
     xp1 = xpb.foo.bar
     xp1_exp = '/foo/bar'
     xp2 = xpb.context(True).foo.bar
     xp2_exp = './foo/bar'
     self.assertEqual(xp1.tostring(), xp1_exp)
     self.assertEqual(xp2.tostring(), xp2_exp)
     self.assertFalse(xpb.context_item)
Exemplo n.º 3
0
 def test_context_item4(self):
     """test context item (nested expression) (written ops)"""
     xpb = XPathBuilder()
     xp = xpb.foo.where(xpb.context(True).bar.log_or(xpb.context(True).baz))
     exp = '/foo[./bar or ./baz]'
     self.assertEqual(xp.tostring(), exp)
Exemplo n.º 4
0
 def test_context_item3(self):
     """test context item (nested expression)"""
     xpb = XPathBuilder()
     xp = xpb.foo[xpb.context(True).bar | xpb.context(True).baz]
     exp = '/foo[./bar or ./baz]'
     self.assertEqual(xp.tostring(), exp)
Exemplo n.º 5
0
 def test_context_item4(self):
     """test context item (nested expression) (written ops)"""
     xpb = XPathBuilder()
     xp = xpb.foo.where(xpb.context(True).bar.log_or(xpb.context(True).baz))
     exp = '/foo[./bar or ./baz]'
     self.assertEqual(xp.tostring(), exp)
Exemplo n.º 6
0
 def test_context_item3(self):
     """test context item (nested expression)"""
     xpb = XPathBuilder()
     xp = xpb.foo[xpb.context(True).bar | xpb.context(True).baz]
     exp = '/foo[./bar or ./baz]'
     self.assertEqual(xp.tostring(), exp)