Пример #1
0
 def equalityOperator(i1, i2):
     type1 = type(i1)
     type2 = type(i2)
     if type1 == BooleanType or type2 == BooleanType:
         return operator(boolean(i1), boolean(i2))
     if type1 == FloatType or type2 == FloatType:
         return operator(number(i1), number(i2))
     return operator(string(i1), string(i2))
Пример #2
0
 def equalityOperator(i1, i2) :
   type1 = type(i1)
   type2 = type(i2)
   if type1 == BooleanType or type2 == BooleanType :
     return operator(boolean(i1), boolean(i2))
   if type1 == FloatType or type2 == FloatType :
     return operator(number(i1), number(i2))
   return operator(string(i1), string(i2))
Пример #3
0
 def nodeSetCapableOperator(i1, i2):
     i1 = unPack(i1)
     i2 = unPack(i2)
     type1 = type(i1)
     type2 = type(i2)
     if type1 == BooleanType or type2 == BooleanType:
         return operator(boolean(i1), boolean(i2))
     if isaSequence(i1):
         if isaSequence(i2):
             i2 = list(i2)
             return any(i1, lambda i: any(i2, op(i)))
         return any(i1, op(i2))
     if isaSequence(i2):
         return any(i2, op(i1))
     return operator(i1, i2)
Пример #4
0
 def nodeSetCapableOperator(i1, i2) :
   i1 = unPack(i1)
   i2 = unPack(i2)
   type1 = type(i1)
   type2 = type(i2)
   if type1 == BooleanType or type2 == BooleanType :
     return operator(boolean(i1),boolean(i2))
   if isaSequence(i1) :
     if isaSequence(i2) :
       i2 = list(i2)
       return any(i1, lambda i : any(i2, op(i)))
     return any(i1, op(i2))
   if isaSequence(i2) :
     return any(i2, op(i1))
   return operator(i1,i2)
Пример #5
0
 def testboolean12(self):
     self.assert_(not boolean([False]))
Пример #6
0
 def testboolean19(self) :
   self.assert_(boolean(["a string"]))
Пример #7
0
 def testUnPackThenBoolena17(self):
     self.assert_(boolean(unPack("a string")))
Пример #8
0
 def testUnPackThenBoolena13(self):
     self.assert_(not boolean(unPack(iter([float(0)]))))
Пример #9
0
 def testUnPackThenBoolena6(self):
     self.assert_(
         boolean(
             unPack(iter(list(
                 self.test_doc1.getElementsByTagName("four"))))))
Пример #10
0
 def testboolean23(self):
     self.assert_(boolean(self.test_doc1.getElementsByTagName("four")))
Пример #11
0
 def testboolean18(self):
     self.assert_(not boolean([""]))
Пример #12
0
 def testUnPackThenBoolena5(self) :
   self.assert_(not boolean(unPack(iter(list(self.test_doc1.getElementsByTagName("notag"))))))
Пример #13
0
 def testboolean27(self) :
   self.assert_(boolean(iter(list(self.test_doc1.getElementsByTagName("four")))))
Пример #14
0
 def testboolean26(self) :
   self.assert_(not boolean(iter(list(self.test_doc1.getElementsByTagName("notag")))))
Пример #15
0
 def testboolean23(self) :
   self.assert_(boolean(self.test_doc1.getElementsByTagName("four")))
Пример #16
0
 def testboolean21(self) :
   self.assert_(boolean(iter(["a string"])))
Пример #17
0
 def testboolean20(self) :
   self.assert_(not boolean(iter([""])))
Пример #18
0
 def testboolean14(self):
     self.assert_(not boolean(iter([False])))
Пример #19
0
 def testboolean16(self):
     self.assert_(not boolean(""))
Пример #20
0
 def testUnPackThenBoolena6(self) :
   self.assert_(boolean(unPack(iter(list(self.test_doc1.getElementsByTagName("four"))))))
Пример #21
0
 def testboolean20(self):
     self.assert_(not boolean(iter([""])))
Пример #22
0
 def testUnPackThenBoolena7(self) :
   self.assert_(not boolean(unPack(float(0))))
Пример #23
0
 def testboolean27(self):
     self.assert_(
         boolean(iter(list(self.test_doc1.getElementsByTagName("four")))))
Пример #24
0
 def testUnPackThenBoolena8(self) :
   self.assert_(boolean(unPack(float(1))))
Пример #25
0
 def testUnPackThenBoolena8(self):
     self.assert_(boolean(unPack(float(1))))
Пример #26
0
 def testUnPackThenBoolena9(self) :
   self.assert_(boolean(unPack(float(123.5623))))
Пример #27
0
 def testUnPackThenBoolena15(self):
     self.assert_(boolean(unPack(iter([float(123.5623)]))))
Пример #28
0
 def testUnPackThenBoolena13(self) :
   self.assert_(not boolean(unPack(iter([float(0)]))))
Пример #29
0
 def testUnPackThenBoolena20(self):
     self.assert_(not boolean(unPack(iter([""]))))
Пример #30
0
 def testUnPackThenBoolena14(self) :
   self.assert_(boolean(unPack(iter([float(1)]))))
Пример #31
0
 def predicateTest(node, predicate_value) :
   unpacked = unPack(predicate_value)
   if type(unpacked) == FloatType :
     return unpacked == node[1]
   else :
     return boolean(unpacked)
Пример #32
0
 def testUnPackThenBoolena15(self) :
   self.assert_(boolean(unPack(iter([float(123.5623)]))))
Пример #33
0
 def testboolean13(self):
     self.assert_(boolean([True]))
Пример #34
0
 def testUnPackThenBoolena16(self) :
   self.assert_(not boolean(unPack("")))
Пример #35
0
 def testboolean15(self):
     self.assert_(boolean(iter([True])))
Пример #36
0
 def testUnPackThenBoolena17(self) :
   self.assert_(boolean(unPack("a string")))
Пример #37
0
 def testboolean17(self):
     self.assert_(boolean("a string"))
Пример #38
0
 def testUnPackThenBoolena18(self) :
   self.assert_(not boolean(unPack([""])))
Пример #39
0
 def testboolean19(self):
     self.assert_(boolean(["a string"]))
Пример #40
0
 def testUnPackThenBoolena20(self) :
   self.assert_(not boolean(unPack(iter([""]))))
Пример #41
0
 def testboolean21(self):
     self.assert_(boolean(iter(["a string"])))
Пример #42
0
 def testUnPackThenBoolena21(self) :
   self.assert_(boolean(unPack(iter(["a string"]))))
Пример #43
0
 def testboolean26(self):
     self.assert_(not boolean(
         iter(list(self.test_doc1.getElementsByTagName("notag")))))
Пример #44
0
 def testboolean1(self) :
   self.assert_(not boolean(float(0)))
Пример #45
0
 def testUnPackThenBoolena5(self):
     self.assert_(not boolean(
         unPack(iter(list(self.test_doc1.getElementsByTagName("notag"))))))
Пример #46
0
 def testboolean2(self) :
   self.assert_(boolean(float(1)))
Пример #47
0
 def testUnPackThenBoolena7(self):
     self.assert_(not boolean(unPack(float(0))))
Пример #48
0
 def testboolean3(self) :
   self.assert_(boolean(float(123.5623)))
Пример #49
0
 def testUnPackThenBoolena9(self):
     self.assert_(boolean(unPack(float(123.5623))))
Пример #50
0
def xpath_function_not(context, args, env) :
  yield not datamodel.boolean(args[0])
Пример #51
0
 def testUnPackThenBoolena14(self):
     self.assert_(boolean(unPack(iter([float(1)]))))
Пример #52
0
def boolean(context, args, env) :
  yield datamodel.boolean(args[0])
Пример #53
0
 def testUnPackThenBoolena16(self):
     self.assert_(not boolean(unPack("")))
Пример #54
0
 def testboolean1(self):
     self.assert_(not boolean(float(0)))
Пример #55
0
 def testUnPackThenBoolena18(self):
     self.assert_(not boolean(unPack([""])))
Пример #56
0
 def testboolean17(self) :
   self.assert_(boolean("a string"))
Пример #57
0
 def testUnPackThenBoolena21(self):
     self.assert_(boolean(unPack(iter(["a string"]))))
Пример #58
0
 def testboolean18(self) :
   self.assert_(not boolean([""]))
Пример #59
0
 def testboolean2(self):
     self.assert_(boolean(float(1)))
Пример #60
0
 def booleanOperator(i1, i2) :
   return operator(boolean(i1), boolean(i2))