diff options
| author | Eric Wieser <wieser.eric@gmail.com> | 2017-11-30 21:10:11 -0800 |
|---|---|---|
| committer | Eric Wieser <wieser.eric@gmail.com> | 2017-12-01 08:49:44 -0800 |
| commit | 4c28c8fd8d3ae68ce5ecb23926d8b29c98ab39ba (patch) | |
| tree | 4060701eb42c07a10bab5529aed3a3383c972735 | |
| parent | fdd5c2d309c859f91784716ab03671c362ebbaba (diff) | |
| download | numpy-4c28c8fd8d3ae68ce5ecb23926d8b29c98ab39ba.tar.gz | |
TST: Move formatting tests into test_arrayprint
| -rw-r--r-- | numpy/core/tests/test_arrayprint.py | 18 | ||||
| -rw-r--r-- | numpy/core/tests/test_multiarray.py | 20 |
2 files changed, 18 insertions, 20 deletions
diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py index b63957c72..993edd41d 100644 --- a/numpy/core/tests/test_arrayprint.py +++ b/numpy/core/tests/test_arrayprint.py @@ -238,6 +238,24 @@ class TestArray2String(object): "[0 ... 0]" ) + def test_summarize_1d(self): + A = np.arange(1001) + strA = '[ 0 1 2 ... 998 999 1000]' + assert_equal(str(A), strA) + + reprA = 'array([ 0, 1, 2, ..., 998, 999, 1000])' + assert_equal(repr(A), reprA) + + def test_summarize_2d(self): + A = np.arange(1002).reshape(2, 501) + strA = '[[ 0 1 2 ... 498 499 500]\n' \ + ' [ 501 502 503 ... 999 1000 1001]]' + assert_equal(str(A), strA) + + reprA = 'array([[ 0, 1, 2, ..., 498, 499, 500],\n' \ + ' [ 501, 502, 503, ..., 999, 1000, 1001]])' + assert_equal(repr(A), reprA) + class TestPrintOptions(object): """Test getting and setting global print options.""" diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index a625a1bce..306f21f16 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -5677,26 +5677,6 @@ class TestInner(object): assert_equal(np.inner(b, a).transpose(2,3,0,1), desired) -class TestSummarization(object): - def test_1d(self): - A = np.arange(1001) - strA = '[ 0 1 2 ... 998 999 1000]' - assert_(str(A) == strA) - - reprA = 'array([ 0, 1, 2, ..., 998, 999, 1000])' - assert_(repr(A) == reprA) - - def test_2d(self): - A = np.arange(1002).reshape(2, 501) - strA = '[[ 0 1 2 ... 498 499 500]\n' \ - ' [ 501 502 503 ... 999 1000 1001]]' - assert_(str(A) == strA) - - reprA = 'array([[ 0, 1, 2, ..., 498, 499, 500],\n' \ - ' [ 501, 502, 503, ..., 999, 1000, 1001]])' - assert_(repr(A) == reprA) - - class TestAlen(object): def test_basic(self): m = np.array([1, 2, 3]) |
