diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2018-08-27 17:43:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-27 17:43:52 -0500 |
| commit | ac4d4807c5b4b61aae59a656beb1b3feed59386b (patch) | |
| tree | c7aaf90bc5d60e00c2d69855105a9a4c5638a00e | |
| parent | d210300bc1b1a849a5df618b47b00cba501f51b4 (diff) | |
| parent | 616017dc89d3d42f748d8fe1eb819b0f728862f7 (diff) | |
| download | numpy-ac4d4807c5b4b61aae59a656beb1b3feed59386b.tar.gz | |
Merge pull request #11823 from tylerjereddy/array2string_kwarg_tst
TST: add test for array2string unexpected kwarg
| -rw-r--r-- | numpy/core/tests/test_arrayprint.py | 10 |
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): |
