Skip to content

Commit

Permalink
update pyfunc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calgray committed May 16, 2022
1 parent f57a36d commit 6ae7562
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/pyfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _init_func_defaults(self):
logger.error(f"Wrong format or type for function defaults for "+\
"{self.f.__name__}: {self.func_defaults}, {type(self.func_defaults)}")
raise ValueError
if self.input_parser is DropParser.PICKLE:
if DropParser(self.input_parser) is DropParser.PICKLE:
# only values are pickled, get them unpickled
for name, value in self.func_defaults.items():
self.func_defaults[name] = deserialize_data(value)
Expand Down
8 changes: 7 additions & 1 deletion daliuge-engine/test/apps/test_pyfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ def _PyFuncApp(oid, uid, f, **kwargs):

fcode, fdefaults = pyfunc.serialize_func(f)
return pyfunc.PyFuncApp(
oid, uid, func_name=fname, func_code=fcode, func_defaults=fdefaults, pickle=True, **kwargs
oid, uid,
func_name=fname,
func_code=fcode,
func_defaults=fdefaults,
input_parser=pyfunc.DropParser.PICKLE,
output_parser=pyfunc.DropParser.PICKLE,
**kwargs
)


Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/test/test_drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def run(self):
assert isinstance(self.f, float)
assert self.f == 2.0
assert isinstance(self.s, str)
assert self.s is "default"
assert self.s == "default"
assert isinstance(self.e, MyEnum)
assert self.e is MyEnum("default")
assert isinstance(self.l, list)
Expand Down

0 comments on commit 6ae7562

Please sign in to comment.