Repository: scipy/scipy_doctest (language: python)

Issue:
Handle array abbreviation for n-dimensional arrays with n > 1
The current implementation works only for 1-dim numpy arrays: 
```python
In [1]: s = "array([     0,      1,      2, ..., 999997, 999998, 999999])"
In [2]: eval(s, {'array': np.array})
Out[2]: array([0, 1, 2, Ellipsis, 999997, 999998, 999999], dtype=object)
```
but produces a `ValueError` for multi-dim arrays as ellipses abbreviate the rows:
```python
In [19]: s = """array([[0.        , 0.        , 0.        , ..., 0.        , 0.        ,
    ...:         0.        ],
    ...:        [0.        , 0.03333333, 0.        , ..., 0.        , 0.        ,
    ...:         0.        ],
    ...:        [0.        , 0.        , 0.06666667, ..., 0.        , 0.        ,
    ...:         0.        ],
    ...:        ...,
    ...:        [0.        , 0.        , 0.        , ..., 1.        , 0.        ,
    ...:         0.        ],
    ...:        [0.        , 0.        , 0.        , ..., 0.        , 1.03333333,
    ...:         0.        ],
    ...:        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,
    ...:         1.06666667]])"""
In [20]: eval(s, {'array': np.array})
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[20], line 1
----> 1 eval(s, {'array': np.array})
File <string>:1
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (7,) + inhomogeneous part.
```


Discussion / hints:

Fix patch:
diff --git a/scpdt/_impl.py b/scpdt/_impl.py
index 479c753..68e1566 100644
--- a/scpdt/_impl.py
+++ b/scpdt/_impl.py
@@ -237,8 +237,6 @@ def check_output(self, want, got, optionflags):
             # Maybe we're printing a numpy array? This produces invalid python
             # code: `print(np.arange(3))` produces "[0 1 2]" w/o commas between
             # values. So, reinsert commas and retry.
-            # TODO: handle (1) abberivation (`print(np.arange(10000))`), and
-            #              (2) n-dim arrays with n > 1
             s_want = want.strip()
             s_got = got.strip()
             cond = (s_want.startswith("[") and s_want.endswith("]") and
@@ -247,6 +245,14 @@ def check_output(self, want, got, optionflags):
                 s_want = ", ".join(s_want[1:-1].split())
                 s_got = ", ".join(s_got[1:-1].split())
                 return self.check_output(s_want, s_got, optionflags)
+            
+            #handle array abbreviation for n-dimensional arrays, n >= 1
+            ndim_array = (s_want.startswith("array([") and s_want.endswith("])") and 
+                          s_got.startswith("array([") and s_got.endswith("])"))
+            if ndim_array:
+                s_want = ''.join(s_want.split('...,'))
+                s_got = ''.join(s_got.split('...,'))
+                return self.check_output(s_want, s_got, optionflags)
 
             # maybe we are dealing with masked arrays?
             # their repr uses '--' for masked values and this is invalid syntax


Test patch:
diff --git a/scpdt/_tests/test_testmod.py b/scpdt/_tests/test_testmod.py
index 9c30992..732879c 100644
--- a/scpdt/_tests/test_testmod.py
+++ b/scpdt/_tests/test_testmod.py
@@ -9,7 +9,7 @@
     import scipy
     HAVE_SCIPY = True
 except:
-    HAVE_SCIPY = FALSE
+    HAVE_SCIPY = False
 
 from . import (module_cases as module,
                stopwords_cases as stopwords,