-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #528, test_registered syncs objects w typemap
- Loading branch information
Showing
3 changed files
with
81 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import dill | ||
from dill._objects import failures, registered, succeeds | ||
import warnings | ||
warnings.filterwarnings('ignore') | ||
|
||
def check(d, ok=True): | ||
res = [] | ||
for k,v in d.items(): | ||
try: | ||
z = dill.copy(v) | ||
if ok: res.append(k) | ||
except: | ||
if not ok: res.append(k) | ||
return res | ||
|
||
assert not bool(check(failures)) | ||
assert not bool(check(registered, ok=False)) | ||
assert not bool(check(succeeds, ok=False)) | ||
|
||
import builtins | ||
import types | ||
q = dill._dill._reverse_typemap | ||
p = {k:v for k,v in q.items() if k not in vars(builtins) and k not in vars(types)} | ||
assert not bool(set(p.keys()).difference(registered.keys())) | ||
assert not bool(set(registered.keys()).difference(p.keys())) | ||
|