def test_bad_things(): f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert type(errors(f)) is PicklingError if IS_PYPY else TypeError d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) s = set([(err.__class__.__name__,err.args[0]) for err in list(errors(f, 1).values())]) a = dict(s) assert len(s) is len(a) # TypeError (and possibly PicklingError) n = 1 if IS_PYPY else 2 assert len(a) is n if 'PicklingError' in a.keys() else n-1
# License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at, globalvars from dill import settings from dill.dill import IS_PYPY from pickle import PicklingError import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert type(errors(f)) is PicklingError if IS_PYPY else TypeError d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) s = set([(err.__class__.__name__, err.args[0]) for err in list(errors(f, 1).values())]) a = dict(s) assert len(s) is len(a) # TypeError (and possibly PicklingError) assert len(a) is 2 if 'PicklingError' in a.keys() else 1 x = [4, 5, 6, 7] listiter = iter(x) obj = parent(listiter, list) assert obj is x
#!/usr/bin/env python # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2015 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert isinstance(errors(f), TypeError) d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) assert len(set([err.args[0] for err in list(errors(f, 1).values())])) is 1 x = [4, 5, 6, 7] listiter = iter(x) obj = parent(listiter, list) assert obj is x assert parent(obj, int) is x[-1] assert at(id(at)) is at
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2015 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at, globalvars from dill import settings import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert isinstance(errors(f), TypeError) d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) s = set([(err.__class__.__name__,err.args[0]) for err in list(errors(f, 1).values())]) a = dict(s) assert len(s) is len(a) # TypeError (and possibly PicklingError) assert len(a) is 2 if 'PicklingError' in a.keys() else 1 x = [4,5,6,7] listiter = iter(x) obj = parent(listiter, list) assert obj is x assert parent(obj, int) is x[-1]
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2015 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at, globalvars from dill import settings import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert isinstance(errors(f), TypeError) d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) assert len(set([err.args[0] for err in list(errors(f, 1).values())])) is 1 x = [4,5,6,7] listiter = iter(x) obj = parent(listiter, list) assert obj is x assert parent(obj, int) is x[-1] assert at(id(at)) is at def f():
# License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at, globalvars from dill import settings from dill.dill import IS_PYPY from pickle import PicklingError import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert type(errors(f)) is PicklingError if IS_PYPY else TypeError d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) s = set([(err.__class__.__name__,err.args[0]) for err in list(errors(f, 1).values())]) a = dict(s) assert len(s) is len(a) # TypeError (and possibly PicklingError) assert len(a) is 2 if 'PicklingError' in a.keys() else 1 x = [4,5,6,7] listiter = iter(x) obj = parent(listiter, list) assert obj is x if IS_PYPY: assert parent(obj, int) is None
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/dill/LICENSE from dill.detect import baditems, badobjects, badtypes, errors, parent, at, globalvars from dill import settings import inspect f = inspect.currentframe() assert baditems(f) == [f] #assert baditems(globals()) == [f] #XXX assert badobjects(f) is f assert badtypes(f) == type(f) assert isinstance(errors(f), TypeError) d = badtypes(f, 1) assert isinstance(d, dict) assert list(badobjects(f, 1).keys()) == list(d.keys()) assert list(errors(f, 1).keys()) == list(d.keys()) s = set([(err.__class__.__name__, err.args[0]) for err in list(errors(f, 1).values())]) a = dict(s) assert len(s) is len(a) # TypeError (and possibly PicklingError) assert len(a) is 2 if 'PicklingError' in a.keys() else 1 x = [4, 5, 6, 7] listiter = iter(x) obj = parent(listiter, list) assert obj is x