Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r73866:83d8f679414d Date: 2014-10-09 13:39 -0400 http://bitbucket.org/pypy/pypy/changeset/83d8f679414d/
Log: check for no args in result_type diff --git a/pypy/module/micronumpy/arrayops.py b/pypy/module/micronumpy/arrayops.py --- a/pypy/module/micronumpy/arrayops.py +++ b/pypy/module/micronumpy/arrayops.py @@ -292,6 +292,8 @@ args_w, kw_w = __args__.unpack() if kw_w: raise oefmt(space.w_TypeError, "result_type() takes no keyword arguments") + if not args_w: + raise oefmt(space.w_ValueError, "at least one array or dtype is required") result = None for w_arg in args_w: if isinstance(w_arg, W_NDimArray): diff --git a/pypy/module/micronumpy/test/test_arrayops.py b/pypy/module/micronumpy/test/test_arrayops.py --- a/pypy/module/micronumpy/test/test_arrayops.py +++ b/pypy/module/micronumpy/test/test_arrayops.py @@ -202,6 +202,8 @@ def test_result_type(self): import numpy as np + exc = raises(ValueError, np.result_type) + assert str(exc.value) == "at least one array or dtype is required" exc = raises(TypeError, np.result_type, a=2) assert str(exc.value) == "result_type() takes no keyword arguments" assert np.result_type(True) is np.dtype('bool') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit