@@ -318,7 +318,7 @@ $ spin smoke-tutorials # ReST user guide tutorials
318318
319319Here is a (non-exhaustive) list of possible gotchas:
320320
321- - _ In-place development builds_ .
321+ #### _ In-place development builds_ .
322322
323323Some tools (looking at you ` meson-python ` ) simulate in-place builds with a
324324` build-install ` directory. If this directory is located under the project root,
@@ -342,7 +342,7 @@ If push really comes to shove, you may try using the magic env variable:
342342however the need usually indicates an issue with the package itself.
343343(see [ gh-107 ] ( https://github.com/scipy/scipy_doctest/pull/107 ) for an example).
344344
345- - _ Optional dependencies are not that optional_
345+ #### _ Optional dependencies are not that optional_
346346
347347If your package contains optional dependencies, doctests do not know about them
348348being optional. So you either guard the imports in doctests (yikes!), or
@@ -361,7 +361,7 @@ Note that installed packages are no different:
361361$ pytest --pyargs scipy --doctest-modules --ignore=/path/to/installed/scipy/_lib
362362```
363363
364- - _ Doctest collection strategies_
364+ #### _ Doctest collection strategies_
365365
366366The default collection strategy follows ` doctest ` module and ` pytest ` . This leads
367367to duplicates if your package has the split between public and \_ private modules,
@@ -383,7 +383,7 @@ leads to
383383- ` scipy.linalg._basic.det ` , collected from ` scipy/linalg/_basic.py ` , is private.
384384- ` scipy.linalg.det ` , collected from ` scipy/linalg/__init__.py ` , is public.
385385
386- - _ ` pytest ` 's assertion rewriting_
386+ #### _ ` pytest ` 's assertion rewriting_
387387
388388In some rare cases you may need to either explicitly register the ` scipy_doctest `
389389package with the ` pytest ` assertion rewriting machinery, or ask it to avoid rewriting
@@ -395,6 +395,21 @@ In general, rewriting assertions is not very useful for doctests, as the
395395output on error is fixed by the doctest machinery anyway. Therefore, we believe
396396adding ` --assert=plain ` is reasonable.
397397
398+ #### _ Mixing strings and numbers_
399+
400+ Generally, we aim to handle mixtures of strings and numeric data. Deeply nested data
401+ structures however may cause the checker to fall back to the vanilla ` doctest ` literal
402+ checking. For instance, ` ["value", 1/3] ` will use the floating-point aware checker, and
403+ so will ` {"value": 1/3, "other value": 2/3} ` or ` [(1, 2), (3, 4)] ` ; Meanwhile, nested
404+ dictionaries, ` {"a": dict(value=1/3)} ` , or lists of tuples with mixed entries,
405+ ` [("a", 1/3), ("b", 2/3)] ` , will currently fall back to vanilla ` doctest ` literal
406+ comparisons.
407+
408+ We stress that no matter how tricky or deeply nested the output is, the worst case
409+ scenario is that the floating-point aware checker is not used. If you have a case where
410+ ` doctest ` works correctly and ` scipy_doctest ` does not, please report it as a bug.
411+
412+
398413## Prior art and related work
399414
400415- ` pytest ` provides some limited floating-point aware ` NumericLiteralChecker ` .
@@ -417,15 +432,15 @@ adding `--assert=plain` is reasonable.
417432 functionality, and uses an AST-based analysis to parse code examples out of docstrings.
418433
419434- ` NumPy ` and ` SciPy ` were using modified doctesting in their ` refguide-check ` utilities.
420- These utilities are tightly coupled to their libraries, and have been reported
435+ These utilities were tightly coupled to their libraries, and have been reported
421436 to be not easy to reason about, work with, and extend to other projects.
422437
423- This project is mainly the core functionality of the modified
424- ` refguide-check ` doctesting, extracted to a separate package.
425- We believe having it separate simplifies both addressing the needs of these
426- two packages, and potential adoption by other projects.
438+ This project is mainly the core functionality of the modified ` refguide-check ` doctesting,
439+ extracted to a separate package. We believe having it separate simplifies both
440+ addressing the needs of these two packages, and adoption by other projects.
441+
427442
428- ### Bug reports, feature requests and contributions
443+ ## Bug reports, feature requests and contributions
429444
430445This package is work in progress. Contributions are most welcome!
431446Please don't hesitate to open an issue in the tracker or send a pull request.
0 commit comments