/usr/lib/python2.7/dist-packages/celery/tests/utils/test_serialization.py is in python-celery 3.1.20-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 31 32 33 34 35 36 37 38 39 40 41 42 | from __future__ import absolute_import
import sys
from celery.utils.serialization import (
UnpickleableExceptionWrapper,
get_pickleable_etype,
)
from celery.tests.case import Case, mask_modules
class test_AAPickle(Case):
def test_no_cpickle(self):
prev = sys.modules.pop('celery.utils.serialization', None)
try:
with mask_modules('cPickle'):
from celery.utils.serialization import pickle
import pickle as orig_pickle
self.assertIs(pickle.dumps, orig_pickle.dumps)
finally:
sys.modules['celery.utils.serialization'] = prev
class test_UnpickleExceptionWrapper(Case):
def test_init(self):
x = UnpickleableExceptionWrapper('foo', 'Bar', [10, lambda x: x])
self.assertTrue(x.exc_args)
self.assertEqual(len(x.exc_args), 2)
class test_get_pickleable_etype(Case):
def test_get_pickleable_etype(self):
class Unpickleable(Exception):
def __reduce__(self):
raise ValueError('foo')
self.assertIs(get_pickleable_etype(Unpickleable), Exception)
|