Exemple #1
0
 def _process(self, sequence, producer):
     if self.wrap:
         products = tuple(map(quickdict, sequence))
         yield (("str", json.encode(quickdict(timetag=datetime.datetime.now(),
                                              products=products))), )
     else:
         for operands in sequence:
             yield (("str", json.encode(quickdict(operands))),)
Exemple #2
0
 def test_encode_decode(self):
     obj = {"timetag": datetime.datetime.now(), "data": b"unittest"}
     encoded = json.encode(obj)
     decoded = json.decode(encoded)
     self.assertEqual(obj, decoded)