Example #1
0
    def test_model_target_on_local(self):
        obj = 1
        file_path = os.path.join(_get_temporary_directory(), 'test.zip')

        target = make_model_target(file_path=file_path,
                                   temporary_directory=_get_temporary_directory(),
                                   save_function=self._save_function,
                                   load_function=self._load_function)

        target.dump(obj)
        loaded = target.load()

        self.assertEqual(loaded, obj)
Example #2
0
    def test_model_target_on_s3(self):
        conn = boto3.resource('s3', region_name='us-east-1')
        conn.create_bucket(Bucket='test')

        obj = 1
        file_path = os.path.join('s3://test/', 'test.zip')

        target = make_model_target(file_path=file_path,
                                   temporary_directory=_get_temporary_directory(),
                                   save_function=self._save_function,
                                   load_function=self._load_function)

        target.dump(obj)
        loaded = target.load()

        self.assertEqual(loaded, obj)