/usr/local/lib/python3.6/site-packages/dill/tests
NameSizeModeActions
__pycache__/-0755rm
test_check.py12780644editdlrm
test_classdef.py48950644editdlrm
test_detect.py41420644editdlrm
test_diff.py27610644editdlrm
test_extendpickle.py13680644editdlrm
test_fglobals.py12970644editdlrm
test_file.py136420644editdlrm
test_functions.py16530644editdlrm
test_functors.py9300644editdlrm
test_mixins.py40070644editdlrm
test_module.py19670644editdlrm
test_moduledict.py11820644editdlrm
test_nested.py31340644editdlrm
test_objects.py17790644editdlrm
test_properties.py13460644editdlrm
test_recursive.py24550644editdlrm
test_restricted.py7830644editdlrm
test_selected.py25550644editdlrm
test_source.py63750644editdlrm
test_temp.py26190644editdlrm
test_weakref.py20560644editdlrm
__init__.py5010644editdlrm
__main__.py8350644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/dill/tests/test_weakref.py (2056B)
#!/usr/bin/env python # # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 2008-2016 California Institute of Technology. # Copyright (c) 2016-2021 The Uncertainty Quantification Foundation. # License: 3-clause BSD. The full license text is available at: # - https://github.com/uqfoundation/dill/blob/master/LICENSE import dill dill.settings['recurse'] = True import weakref class _class: def _method(self): pass class _class2: def __call__(self): pass class _newclass(object): def _method(self): pass class _newclass2(object): def __call__(self): pass def _function(): pass def test_weakref(): o = _class() oc = _class2() n = _newclass() nc = _newclass2() f = _function z = _class x = _newclass r = weakref.ref(o) dr = weakref.ref(_class()) p = weakref.proxy(o) dp = weakref.proxy(_class()) c = weakref.proxy(oc) dc = weakref.proxy(_class2()) m = weakref.ref(n) dm = weakref.ref(_newclass()) t = weakref.proxy(n) dt = weakref.proxy(_newclass()) d = weakref.proxy(nc) dd = weakref.proxy(_newclass2()) fr = weakref.ref(f) fp = weakref.proxy(f) #zr = weakref.ref(z) #XXX: weakrefs not allowed for classobj objects #zp = weakref.proxy(z) #XXX: weakrefs not allowed for classobj objects xr = weakref.ref(x) xp = weakref.proxy(x) objlist = [r,dr,m,dm,fr,xr, p,dp,t,dt, c,dc,d,dd, fp,xp] #dill.detect.trace(True) for obj in objlist: res = dill.detect.errors(obj) if res: print ("%s" % res) #print ("%s:\n %s" % (obj, res)) # else: # print ("PASS: %s" % obj) assert not res def test_dictproxy(): from dill._dill import DictProxyType try: m = DictProxyType({"foo": "bar"}) except: m = type.__dict__ mp = dill.copy(m) assert mp.items() == m.items() if __name__ == '__main__': test_weakref() from dill._dill import IS_PYPY if not IS_PYPY: test_dictproxy()