Esempio n. 1
0
 def test_from_list(self):
     baz_man = JSONObject("baz man!")
     lst = [JSONObject("foo"), JSONObject("bar"), baz_man]
     data = JSONObjectDict.from_list(lst)
     self.failUnlessEqual(len(data), len(lst))
     self.failUnless("baz man!" in data)
     self.failUnlessEqual(baz_man, data["baz man!"])
Esempio n. 2
0
 def __init__(self, name=None, command=None, pattern="<~filename>",
              unique=False, parameter=None, max_args=10000,
              warn_threshold=100):
     JSONObject.__init__(self, name)
     self.command = str(command or "")
     self.pattern = str(pattern)
     self.unique = bool(unique)
     self.max_args = max_args
     self.parameter = str(parameter or "")
     self.__pat = Pattern(self.pattern)
     self.warn_threshold = warn_threshold
Esempio n. 3
0
 def __init__(self, name=None, command=None, pattern="<~filename>",
              unique=False, parameter=None, max_args=10000,
              warn_threshold=50):
     JSONObject.__init__(self, name)
     self.command = str(command or "")
     self.pattern = str(pattern)
     self.unique = bool(unique)
     self.max_args = max_args
     self.parameter = str(parameter or "")
     self.__pat = Pattern(self.pattern)
     self.warn_threshold = warn_threshold
Esempio n. 4
0
 def test_nameless_construction(self):
     try:
         self.failIf(JSONObject())
     except TypeError:
         pass
     else:
         self.fail("Name should be enforced at constructor")
Esempio n. 5
0
 def test_JSONObject(self):
     blah = JSONObject('blah')
     self.failUnlessEqual(blah.name, 'blah')
     self.failUnlessEqual(blah.data, {"name": "blah"})
     self.failUnlessEqual(blah.json, "{\"name\": \"blah\"}")
Esempio n. 6
0
 def __init__(self, name=None, pattern=None, wibble=False):
     JSONObject.__init__(self, name)
     self.pattern = pattern
     self.wibble = wibble
     self._dont_wibble = not wibble
 def __init__(self, name=None, pattern=None, wibble=False):
     JSONObject.__init__(self, name)
     self.pattern = pattern
     self.wibble = wibble
     self._dont_wibble = not wibble