Skip to content

Commit

Permalink
FIX argument propogation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jbn committed Jul 17, 2018
1 parent 3e1c1dc commit 47e1356
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modpipe/__init__.py
Expand Up @@ -3,4 +3,4 @@

__author__ = """John Bjorn Nelson"""
__email__ = 'jbn@abreka.com'
__version__ = '0.0.2'
__version__ = '0.0.3'
7 changes: 6 additions & 1 deletion modpipe/modpipe_impl.py
Expand Up @@ -217,7 +217,12 @@ def apply_to(self, f, arity):
else:
res = f(self.args)

return res if isinstance(res, Result) else Result(res)
if isinstance(res, Result):
return res
elif res is not None:
return Result(res)
else:
return Result(self.args)


class Done(Result):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -37,6 +37,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/jbn/modpipe',
version='0.0.2',
version='0.0.3',
zip_safe=False,
)
14 changes: 14 additions & 0 deletions tests/examples/inconsistent_pipeline.py
@@ -0,0 +1,14 @@
def f(x):
return {'value': x}


def g(src):
return src, {}


def h(src, dst):
dst['computation'] = src['value'] * 2


def last_one(src, dst):
return dst
8 changes: 8 additions & 0 deletions tests/test_regressions.py
@@ -0,0 +1,8 @@
from modpipe import ModPipe


def test_inconsistent_pipeline():
pipe = ModPipe('tests.examples.inconsistent_pipeline')
res = pipe(1)

assert res == {'computation': 2}

0 comments on commit 47e1356

Please sign in to comment.