scipy-doctest 1.4__tar.gz → 1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scipy_doctest-1.4 → scipy_doctest-1.5}/PKG-INFO +2 -2
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/__init__.py +1 -1
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/impl.py +38 -5
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/module_cases.py +21 -9
- {scipy_doctest-1.4 → scipy_doctest-1.5}/LICENSE +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/README.md +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/pyproject.toml +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/__main__.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/conftest.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/frontend.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/plugin.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/__init__.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/failure_cases.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/failure_cases_2.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/finder_cases.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/local_file.txt +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/local_file_cases.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/octave_a.mat +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/scipy_ndimage_tutorial_clone.rst +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/stopwords_cases.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_finder.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_parser.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_pytest_configuration.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_runner.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_skipmarkers.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_testfile.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/test_testmod.py +0 -0
- {scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: scipy_doctest
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5
|
|
4
4
|
Summary: Configurable, whitespace-insensitive, floating-point-aware doctest helpers.
|
|
5
5
|
Maintainer-email: SciPy developers <scipy-dev@python.org>
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -148,8 +148,12 @@ class DTConfig:
|
|
|
148
148
|
'masked_array': np.ma.masked_array,
|
|
149
149
|
'int64': np.int64,
|
|
150
150
|
'uint64': np.uint64,
|
|
151
|
-
'int8': np.int8,
|
|
152
151
|
'int32': np.int32,
|
|
152
|
+
'uint32': np.uint32,
|
|
153
|
+
'int16': np.int16,
|
|
154
|
+
'uint16': np.uint16,
|
|
155
|
+
'int8': np.int8,
|
|
156
|
+
'uint8': np.uint8,
|
|
153
157
|
'float32': np.float32,
|
|
154
158
|
'float64': np.float64,
|
|
155
159
|
'dtype': np.dtype,
|
|
@@ -262,6 +266,29 @@ def has_masked(got):
|
|
|
262
266
|
return 'masked_array' in got and '--' in got
|
|
263
267
|
|
|
264
268
|
|
|
269
|
+
def try_split_shape_from_abbrv(s_got):
|
|
270
|
+
"""NumPy 2.2 added shape=(123,) to abbreviated array repr.
|
|
271
|
+
|
|
272
|
+
If present, split it off, and return a tuple. `(array, shape)`
|
|
273
|
+
"""
|
|
274
|
+
if "shape=" in s_got:
|
|
275
|
+
# handle
|
|
276
|
+
# array(..., shape=(1000,))
|
|
277
|
+
# array(..., shape=(100, 100))
|
|
278
|
+
# array(..., shape=(100, 100), dtype=uint16)
|
|
279
|
+
match = re.match(r'(.+),\s+shape=\(([\d\s,]+)\)(.+)', s_got, flags=re.DOTALL)
|
|
280
|
+
if match:
|
|
281
|
+
grp = match.groups()
|
|
282
|
+
|
|
283
|
+
s_got = grp[0] + grp[-1]
|
|
284
|
+
s_got = s_got.replace(',,', ',')
|
|
285
|
+
shape_str = f'({grp[1]})'
|
|
286
|
+
|
|
287
|
+
return ''.join(s_got.split('...,')), shape_str
|
|
288
|
+
|
|
289
|
+
return ''.join(s_got.split('...,')), ''
|
|
290
|
+
|
|
291
|
+
|
|
265
292
|
class DTChecker(doctest.OutputChecker):
|
|
266
293
|
obj_pattern = re.compile(r'at 0x[0-9a-fA-F]+>')
|
|
267
294
|
vanilla = doctest.OutputChecker()
|
|
@@ -325,11 +352,17 @@ class DTChecker(doctest.OutputChecker):
|
|
|
325
352
|
return self.check_output(s_want, s_got, optionflags)
|
|
326
353
|
|
|
327
354
|
#handle array abbreviation for n-dimensional arrays, n >= 1
|
|
328
|
-
ndim_array = (s_want.startswith("array([") and
|
|
329
|
-
s_got.startswith("array([") and
|
|
355
|
+
ndim_array = (s_want.startswith("array([") and "..." in s_want and
|
|
356
|
+
s_got.startswith("array([") and "..." in s_got)
|
|
330
357
|
if ndim_array:
|
|
331
|
-
s_want =
|
|
332
|
-
s_got =
|
|
358
|
+
s_want, want_shape = try_split_shape_from_abbrv(s_want)
|
|
359
|
+
s_got, got_shape = try_split_shape_from_abbrv(s_got)
|
|
360
|
+
|
|
361
|
+
if got_shape:
|
|
362
|
+
# NumPy 2.2 output, `with shape=`, check the shapes, too
|
|
363
|
+
s_want = f"{s_want}, {want_shape}"
|
|
364
|
+
s_got = f"{s_got}, {got_shape}"
|
|
365
|
+
|
|
333
366
|
return self.check_output(s_want, s_got, optionflags)
|
|
334
367
|
|
|
335
368
|
# maybe we are dealing with masked arrays?
|
|
@@ -164,14 +164,25 @@ def array_abbreviation():
|
|
|
164
164
|
"""
|
|
165
165
|
Numpy abbreviates arrays, check that it works.
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
XXX: check if ... creates ragged arrays, avoid if so.
|
|
168
|
+
|
|
169
|
+
NumPy 2.2 abbreviations
|
|
170
|
+
=======================
|
|
171
|
+
|
|
172
|
+
NumPy 2.2 adds shape=(...) to abbreviated arrays.
|
|
173
|
+
|
|
174
|
+
This is not a valid argument to `array(...), so it cannot be eval-ed,
|
|
175
|
+
and need to be removed for doctesting.
|
|
176
|
+
|
|
177
|
+
The implementation handles both formats, and checks the shapes if present
|
|
178
|
+
in the actual output. If not present in the output, they are ignored.
|
|
179
|
+
|
|
172
180
|
>>> import numpy as np
|
|
173
181
|
>>> np.arange(10000)
|
|
174
|
-
array([0, 1, 2, ..., 9997, 9998, 9999])
|
|
182
|
+
array([0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,))
|
|
183
|
+
|
|
184
|
+
>>> np.arange(10000, dtype=np.uint16)
|
|
185
|
+
array([ 0, 1, 2, ..., 9997, 9998, 9999], shape=(10000,), dtype=uint16)
|
|
175
186
|
|
|
176
187
|
>>> np.diag(np.arange(33)) / 30
|
|
177
188
|
array([[0., 0., 0., ..., 0., 0.,0.],
|
|
@@ -180,19 +191,20 @@ def array_abbreviation():
|
|
|
180
191
|
...,
|
|
181
192
|
[0., 0., 0., ..., 1., 0., 0.],
|
|
182
193
|
[0., 0., 0., ..., 0., 1.03333333, 0.],
|
|
183
|
-
[0., 0., 0., ..., 0., 0., 1.06666667]])
|
|
194
|
+
[0., 0., 0., ..., 0., 0., 1.06666667]], shape=(33, 33))
|
|
184
195
|
|
|
185
196
|
|
|
186
|
-
>>> np.diag(np.arange(1, 1001, dtype=
|
|
197
|
+
>>> np.diag(np.arange(1, 1001, dtype=np.uint16))
|
|
187
198
|
array([[1, 0, 0, ..., 0, 0, 0],
|
|
188
199
|
[0, 2, 0, ..., 0, 0, 0],
|
|
189
200
|
[0, 0, 3, ..., 0, 0, 0],
|
|
190
201
|
...,
|
|
191
202
|
[0, 0, 0, ..., 998, 0, 0],
|
|
192
203
|
[0, 0, 0, ..., 0, 999, 0],
|
|
193
|
-
[0, 0, 0, ..., 0, 0, 1000]])
|
|
204
|
+
[0, 0, 0, ..., 0, 0, 1000]], shape=(1000, 1000), dtype=uint16)
|
|
194
205
|
"""
|
|
195
206
|
|
|
207
|
+
|
|
196
208
|
def nan_equal():
|
|
197
209
|
"""
|
|
198
210
|
Test that nans are treated as equal.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scipy_doctest-1.4 → scipy_doctest-1.5}/scipy_doctest/tests/scipy_ndimage_tutorial_clone.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|