diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-09-17 13:08:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-17 13:08:06 +0300 |
commit | 85ef9f267b3927c14ddd970f25d3b55d9be823ba (patch) | |
tree | 0d701826ee10f4f9c66f0538ef67c231b950116d /numpy/lib/tests/test_arraypad.py | |
parent | 73d7871970a951edd48e5c40bdc7609385ce61e6 (diff) | |
parent | 8db79e027515b835f7f98e9c9ba104c80545f546 (diff) | |
download | numpy-85ef9f267b3927c14ddd970f25d3b55d9be823ba.tar.gz |
Merge pull request #11958 from hmaarrfk/test_pad_object
TST: Add a test for np.pad where constant_values is an object
Diffstat (limited to 'numpy/lib/tests/test_arraypad.py')
-rw-r--r-- | numpy/lib/tests/test_arraypad.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index 45d624781..243110391 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -502,6 +502,21 @@ class TestConstant(object): expected = np.full(7, int64_max, dtype=np.int64) assert_array_equal(test, expected) + def test_check_object_array(self): + arr = np.empty(1, dtype=object) + obj_a = object() + arr[0] = obj_a + obj_b = object() + obj_c = object() + arr = np.pad(arr, pad_width=1, mode='constant', + constant_values=(obj_b, obj_c)) + + expected = np.empty((3,), dtype=object) + expected[0] = obj_b + expected[1] = obj_a + expected[2] = obj_c + + assert_array_equal(arr, expected) class TestLinearRamp(object): def test_check_simple(self): |