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