summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2018-08-27 10:53:06 -0700
committerTyler Reddy <tyler.je.reddy@gmail.com>2018-08-27 10:53:06 -0700
commit616017dc89d3d42f748d8fe1eb819b0f728862f7 (patch)
treec7aaf90bc5d60e00c2d69855105a9a4c5638a00e /numpy
parentd210300bc1b1a849a5df618b47b00cba501f51b4 (diff)
downloadnumpy-616017dc89d3d42f748d8fe1eb819b0f728862f7.tar.gz
TST: add test for array2string unexpected kwarg.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_arrayprint.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py
index 6214e325c..6522c6e8a 100644
--- a/numpy/core/tests/test_arrayprint.py
+++ b/numpy/core/tests/test_arrayprint.py
@@ -8,6 +8,7 @@ import pytest
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_warns, HAS_REFCOUNT,
+ assert_raises_regex,
)
import textwrap
@@ -210,6 +211,15 @@ class TestArray2String(object):
assert_(np.array2string(a, max_line_width=4, legacy='1.13') == '[0 1\n 2]')
assert_(np.array2string(a, max_line_width=4) == '[0\n 1\n 2]')
+ def test_unexpected_kwarg(self):
+ # ensure than an appropriate TypeError
+ # is raised when array2string receives
+ # an unexpected kwarg
+
+ with assert_raises_regex(TypeError, 'nonsense'):
+ np.array2string(np.array([1, 2, 3]),
+ nonsense=None)
+
def test_format_function(self):
"""Test custom format function for each element in array."""
def _format_function(x):