Skip to content

Commit 4c28c8f

Browse files
committed
TST: Move formatting tests into test_arrayprint
1 parent fdd5c2d commit 4c28c8f

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

numpy/core/tests/test_arrayprint.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,24 @@ def test_edgeitems_kwarg(self):
238238
"[0 ... 0]"
239239
)
240240

241+
def test_summarize_1d(self):
242+
A = np.arange(1001)
243+
strA = '[ 0 1 2 ... 998 999 1000]'
244+
assert_equal(str(A), strA)
245+
246+
reprA = 'array([ 0, 1, 2, ..., 998, 999, 1000])'
247+
assert_equal(repr(A), reprA)
248+
249+
def test_summarize_2d(self):
250+
A = np.arange(1002).reshape(2, 501)
251+
strA = '[[ 0 1 2 ... 498 499 500]\n' \
252+
' [ 501 502 503 ... 999 1000 1001]]'
253+
assert_equal(str(A), strA)
254+
255+
reprA = 'array([[ 0, 1, 2, ..., 498, 499, 500],\n' \
256+
' [ 501, 502, 503, ..., 999, 1000, 1001]])'
257+
assert_equal(repr(A), reprA)
258+
241259

242260
class TestPrintOptions(object):
243261
"""Test getting and setting global print options."""

numpy/core/tests/test_multiarray.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5677,26 +5677,6 @@ def test_3d_tensor(self):
56775677
assert_equal(np.inner(b, a).transpose(2,3,0,1), desired)
56785678

56795679

5680-
class TestSummarization(object):
5681-
def test_1d(self):
5682-
A = np.arange(1001)
5683-
strA = '[ 0 1 2 ... 998 999 1000]'
5684-
assert_(str(A) == strA)
5685-
5686-
reprA = 'array([ 0, 1, 2, ..., 998, 999, 1000])'
5687-
assert_(repr(A) == reprA)
5688-
5689-
def test_2d(self):
5690-
A = np.arange(1002).reshape(2, 501)
5691-
strA = '[[ 0 1 2 ... 498 499 500]\n' \
5692-
' [ 501 502 503 ... 999 1000 1001]]'
5693-
assert_(str(A) == strA)
5694-
5695-
reprA = 'array([[ 0, 1, 2, ..., 498, 499, 500],\n' \
5696-
' [ 501, 502, 503, ..., 999, 1000, 1001]])'
5697-
assert_(repr(A) == reprA)
5698-
5699-
57005680
class TestAlen(object):
57015681
def test_basic(self):
57025682
m = np.array([1, 2, 3])

0 commit comments

Comments
 (0)