コード例 #1
0
ファイル: test_xpath.py プロジェクト: ye-man/commcare-hq
    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')))
コード例 #2
0
ファイル: test_xpath.py プロジェクト: saketkanth/commcare-hq
 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)
コード例 #3
0
ファイル: test_xpath.py プロジェクト: ye-man/commcare-hq
 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)
コード例 #4
0
ファイル: test_xpath.py プロジェクト: saketkanth/commcare-hq
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))
コード例 #5
0
ファイル: test_xpath.py プロジェクト: saketkanth/commcare-hq
    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')))
コード例 #6
0
ファイル: test_xpath.py プロジェクト: ye-man/commcare-hq
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))