/opt/imh-python/lib/python3.9/site-packages/dill/tests
NameSizeModeActions
__pycache__/-0755rm
test_abc.py42270644editdlrm
test_check.py13960644editdlrm
test_classdef.py86000644editdlrm
test_dataclasses.py8900644editdlrm
test_detect.py41440644editdlrm
test_dictviews.py13370644editdlrm
test_diff.py26670644editdlrm
test_extendpickle.py13150644editdlrm
test_fglobals.py16760644editdlrm
test_file.py135780644editdlrm
test_functions.py42670644editdlrm
test_functors.py9300644editdlrm
test_logger.py23850644editdlrm
test_mixins.py40070644editdlrm
test_module.py19430644editdlrm
test_moduledict.py11820644editdlrm
test_nested.py31460644editdlrm
test_objects.py19310644editdlrm
test_properties.py13460644editdlrm
test_pycapsule.py14170644editdlrm
test_recursive.py41820644editdlrm
test_registered.py15730644editdlrm
test_restricted.py7830644editdlrm
test_selected.py32580644editdlrm
test_session.py101610644editdlrm
test_source.py70590644editdlrm
test_sources.py86720644editdlrm
test_temp.py26190644editdlrm
test_threads.py12570644editdlrm
test_weakref.py16020644editdlrm
__init__.py4790644editdlrm
__main__.py8990644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/dill/tests/test_module.py (1943B)
#!/usr/bin/env python # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. # Copyright (c) 2016-2025 The Uncertainty Quantification Foundation. # License: 3-clause BSD. The full license text is available at: # - https://github.com/uqfoundation/dill/blob/master/LICENSE import sys import dill import test_mixins as module from importlib import reload dill.settings['recurse'] = True cached = (module.__cached__ if hasattr(module, "__cached__") else module.__file__.split(".", 1)[0] + ".pyc") module.a = 1234 pik_mod = dill.dumps(module) module.a = 0 # remove module del sys.modules[module.__name__] del module module = dill.loads(pik_mod) def test_attributes(): #assert hasattr(module, "a") and module.a == 1234 #FIXME: -m dill.tests assert module.double_add(1, 2, 3) == 2 * module.fx # Restart, and test use_diff reload(module) try: dill.use_diff() module.a = 1234 pik_mod = dill.dumps(module) module.a = 0 # remove module del sys.modules[module.__name__] del module module = dill.loads(pik_mod) def test_diff_attributes(): assert hasattr(module, "a") and module.a == 1234 assert module.double_add(1, 2, 3) == 2 * module.fx except AttributeError: def test_diff_attributes(): pass # clean up import os if os.path.exists(cached): os.remove(cached) pycache = os.path.join(os.path.dirname(module.__file__), "__pycache__") if os.path.exists(pycache) and not os.listdir(pycache): os.removedirs(pycache) # test when module is None import math def get_lambda(str, **kwarg): return eval(str, kwarg, None) obj = get_lambda('lambda x: math.exp(x)', math=math) def test_module_is_none(): assert obj.__module__ is None assert dill.copy(obj)(3) == obj(3) if __name__ == '__main__': test_attributes() test_diff_attributes() test_module_is_none()