Ejemplo n.º 1
0
    def test_and_or(self):
        self.assertEqual('a and b and c', XPath.and_('a', 'b', 'c'))
        self.assertEqual('a and (b and c)',
                         XPath.and_('a', XPath.and_('b', 'c')))

        self.assertEqual('a or b or c', XPath.or_('a', 'b', 'c'))
        self.assertEqual('(a or b) or c',
                         XPath.or_(XPath.or_('a', 'b'), XPath('c')))
Ejemplo n.º 2
0
 def test_complex(self):
     xp = XPath.and_(
         XPath('a').eq('1'),
         XPath('b').neq(XPath.string('')),
         XPath.or_(
             XPath('c').eq(XPath.string('')),
             XPath.date('d').neq('today()')
         ))
     self.assertEqual("a = 1 and b != '' and (c = '' or date(d) != today())", xp)
Ejemplo n.º 3
0
 def test_complex(self):
     xp = XPath.and_(
         XPath('a').eq('1'),
         XPath('b').neq(XPath.string('')),
         XPath.or_(
             XPath('c').eq(XPath.string('')),
             XPath.date('d').neq('today()')))
     self.assertEqual(
         "a = 1 and b != '' and (c = '' or date(d) != today())", xp)
Ejemplo n.º 4
0
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))
Ejemplo n.º 5
0
    def test_and_or(self):
        self.assertEqual('a and b and c', XPath.and_('a', 'b', 'c'))
        self.assertEqual('a and (b and c)', XPath.and_('a', XPath.and_('b', 'c')))

        self.assertEqual('a or b or c', XPath.or_('a', 'b', 'c'))
        self.assertEqual('(a or b) or c', XPath.or_(XPath.or_('a', 'b'), XPath('c')))
Ejemplo n.º 6
0
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))