コード例 #1
0
ファイル: encoding.py プロジェクト: olivopaolo/boing
 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))),)
コード例 #2
0
ファイル: test_json.py プロジェクト: olivopaolo/boing
 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)