/usr/lib/python3/dist-packages/affine/tests/test_pickle.py is in python3-affine 2.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """
Validate that instances of `affine.Affine()` can be pickled and unpickled.
"""
import pickle
from multiprocessing import Pool
import affine
def test_pickle():
a = affine.Affine(1, 2, 3, 4, 5, 6)
assert pickle.loads(pickle.dumps(a)) == a
def _mp_proc(x):
# A helper function - needed for test_with_multiprocessing()
# Can't be defined inside the test because multiprocessing needs
# everything to be in __main__
assert isinstance(x, affine.Affine)
return x
def test_with_multiprocessing():
a1 = affine.Affine(1, 2, 3, 4, 5, 6)
a2 = affine.Affine(6, 5, 4, 3, 2, 1)
results = Pool(2).map(_mp_proc, [a1, a2])
for expected, actual in zip([a1, a2], results):
assert expected == actual
|