summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2018-10-21 08:59:23 +0300
committerGitHub <noreply@github.com>2018-10-21 08:59:23 +0300
commit28b3694aa1eeeaa75068436b79a87a296545fea4 (patch)
tree9e10223901175bc7f64c2a0c522a692a7bc10362
parenteb40e161e2e593762da9c77858343e3720351ce7 (diff)
parentcb3a67b0f20b45f12f6d95dd3b5f82b6377899ae (diff)
downloadnumpy-28b3694aa1eeeaa75068436b79a87a296545fea4.tar.gz
Merge pull request #12222 from tylerjereddy/test_column_stack
TST: unit tests for column_stack.
-rw-r--r--numpy/lib/tests/test_shape_base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index 6e4cd225d..a7f5ca7db 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -461,6 +461,26 @@ class TestColumnStack(object):
def test_non_iterable(self):
assert_raises(TypeError, column_stack, 1)
+ def test_1D_arrays(self):
+ # example from docstring
+ a = np.array((1, 2, 3))
+ b = np.array((2, 3, 4))
+ expected = np.array([[1, 2],
+ [2, 3],
+ [3, 4]])
+ actual = np.column_stack((a, b))
+ assert_equal(actual, expected)
+
+ def test_2D_arrays(self):
+ # same as hstack 2D docstring example
+ a = np.array([[1], [2], [3]])
+ b = np.array([[2], [3], [4]])
+ expected = np.array([[1, 2],
+ [2, 3],
+ [3, 4]])
+ actual = np.column_stack((a, b))
+ assert_equal(actual, expected)
+
class TestDstack(object):
def test_non_iterable(self):