Beispiel #1
0
 def test_basics(self):
     v = ('a' * 10, 'b' * 90)
     pickler = coders.PickleCoder()
     self.assertEquals(v, pickler.decode(pickler.encode(v)))
     pickler = coders.Base64PickleCoder()
     self.assertEquals(v, pickler.decode(pickler.encode(v)))
     self.assertEquals(coders.Base64PickleCoder().encode(v),
                       base64.b64encode(coders.PickleCoder().encode(v)))
 def expand(self, model_directory):
     if self._extract_model_fn:
         return (model_directory
                 | beam.Map(SaveModel._copy_model_dir, self._path,
                            self._extract_model_fn))
     else:
         return (model_directory
                 | beam.Map(SaveModel._copy_model_dir, self._path,
                            self._extract_model_fn)
                 | beam.io.textio.WriteToText(
                     self._path + '.meta',
                     shard_name_template='',
                     coder=coders.Base64PickleCoder()))
Beispiel #3
0
 def test_equality(self):
     self.assertEquals(coders.PickleCoder(), coders.PickleCoder())
     self.assertEquals(coders.Base64PickleCoder(),
                       coders.Base64PickleCoder())
     self.assertNotEquals(coders.Base64PickleCoder(), coders.PickleCoder())
     self.assertNotEquals(coders.Base64PickleCoder(), object())