diff options
author | bertrand <bertrand.l3f@gmail.com> | 2016-01-30 21:00:55 -0500 |
---|---|---|
committer | bertrand <bertrand.l3f@gmail.com> | 2016-01-30 21:00:55 -0500 |
commit | 32ae04a43ccd7a3413deb1711796280f8fa69ba0 (patch) | |
tree | 066b56a473a67c563a31884c7dff7c4952d7bc4b /numpy/lib/tests/test_arraypad.py | |
parent | 9cfdb218b16cba97800fc2ad0f37e1af780ab664 (diff) | |
download | numpy-32ae04a43ccd7a3413deb1711796280f8fa69ba0.tar.gz |
BUG: mode kwargs passed as unicode to np.pad raises an exception
isinstance(mode, str) is False in python2.7 when mode is of unicode
type, and mode is then mistakenly assumed to be a callable. See #7112
Diffstat (limited to 'numpy/lib/tests/test_arraypad.py')
-rw-r--r-- | numpy/lib/tests/test_arraypad.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index 30ea35d55..f19a0b13a 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -953,6 +953,17 @@ class TestNdarrayPadWidth(TestCase): assert_array_equal(a, b) +class TestUnicodeInput(TestCase): + def test_unicode_mode(self): + try: + constant_mode = unicode('constant') + except NameError: + constant_mode = 'constant' + a = np.pad([1], 2, mode=constant_mode) + b = np.array([0, 0, 1, 0, 0]) + assert_array_equal(a, b) + + class ValueError1(TestCase): def test_check_simple(self): arr = np.arange(30) |