pytest2/doc/en
David Röthlisberger aaa7e837cc doctest: Add +NUMBER option to ignore irrelevant floating-point differences
When enabled, floating-point numbers only need to match as far as the
precision you have written in the expected doctest output. This avoids
false positives caused by limited floating-point precision, like this:

    Expected:
        0.233
    Got:
        0.23300000000000001

This is inspired by Sébastien Boisgérault's [numtest] but the
implementation is a bit different:

* This implementation edits the literals that are in the "got"
  string (the actual output from the expression being tested), and then
  proceeds to compare the strings literally. This is similar to pytest's
  existing ALLOW_UNICODE and ALLOW_BYTES implementation.

* This implementation only compares floats against floats, not ints
  against floats. That is, the following doctest will fail with pytest
  whereas it would pass with numtest:

      >>> math.py  # doctest: +NUMBER
      3

  This behaviour should be less surprising (less false negatives) when
  you enable NUMBER globally in pytest.ini.

Advantages of this implementation compared to numtest:

* Doesn't require `import numtest` at the top level of the file.
* Works with pytest (if you try to use pytest & numtest together, pytest
  raises "TypeError: unbound method check_output() must be called with
  NumTestOutputChecker instance as first argument (got
  LiteralsOutputChecker instance instead)").
* Works with Python 3.

[numtest]: https://github.com/boisgera/numtest
2019-07-08 17:07:58 +01:00
..
_templates Drop Python 2.7 and 3.4 support 2019-06-02 14:39:11 -03:00
_themes pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
announce Merge pull request #5520 from asottile/release-4.6.4 2019-06-28 19:09:10 -07:00
example Use shutil.which to avoid distutils+imp warning 2019-06-28 14:44:49 -07:00
img - preliminary sprint page, not yet linked through the header 2016-02-05 11:34:40 +01:00
proposals Spelling and grammar fixes 2018-10-29 23:45:45 +02:00
Makefile Ignore PytestUnknownMark warnings when regen docs 2019-05-08 21:46:26 +00:00
adopt.rst docs warnings as errors and initial page similar to README 2016-08-26 17:47:18 -03:00
assert.rst Remove all version references to obsolete pytest versions 2019-04-28 12:37:58 -03:00
backwards-compatibility.rst [WIP] Introduce deprecations page 2018-09-18 20:56:40 -03:00
bash-completion.rst Fix sphinx code-block types for remaining rst docs 2019-02-15 15:10:37 +02:00
builtin.rst Preparing release version 4.5.0 2019-05-11 16:35:32 +00:00
cache.rst Update cache.rst 2019-06-21 15:48:59 -07:00
capture.rst Remove all version references to obsolete pytest versions 2019-04-28 12:37:58 -03:00
changelog.rst Add a changelog blurb and title, similar to tox 2018-08-04 13:15:20 -03:00
conf.py pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
conftest.py pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
contact.rst apply most other hooks and opt out of black reformating 2018-05-23 16:45:58 +02:00
contents.rst Add link to tidelift to the main docs 2019-05-21 11:12:07 -03:00
contributing.rst Updated documentation from txt to rst 2015-08-04 16:41:02 +05:30
customize.rst Fix a typo 2019-05-03 22:30:20 -07:00
deprecations.rst Deprecate funcargnames alias 2019-06-26 08:53:17 +10:00
development_guide.rst Manage GH labels using the new 'labels' tool 2018-07-14 10:12:52 -03:00
doctest.rst doctest: Add +NUMBER option to ignore irrelevant floating-point differences 2019-07-08 17:07:58 +01:00
existingtestsuite.rst Fix links in docs 2017-04-06 23:29:41 -03:00
faq.rst Update all pypi.python.org URLs to pypi.org 2018-04-26 06:49:33 -07:00
fixture.rst Update fixture.rst 2019-05-21 09:40:31 +03:00
flaky.rst Fix linting2 2018-10-31 11:05:58 -03:00
funcarg_compare.rst Fix formatting of print() calls 2018-11-22 00:15:14 -08:00
funcargs.rst fix line endings 2018-05-23 16:45:23 +02:00
getting-started.rst Drop Python 2.7 and 3.4 support 2019-06-02 14:39:11 -03:00
goodpractices.rst Drop Python 2.7 and 3.4 support 2019-06-02 14:39:11 -03:00
historical-notes.rst Apply suggestions from code review 2019-05-15 20:45:22 -03:00
index.rst Drop Python 2.7 and 3.4 support 2019-06-02 14:39:11 -03:00
license.rst Fix sphinx code-block types for remaining rst docs 2019-02-15 15:10:37 +02:00
links.inc update links.inc to include both venv and virtualenv 2019-02-21 10:41:59 -05:00
logging.rst Remove all version references to obsolete pytest versions 2019-04-28 12:37:58 -03:00
mark.rst Mention "-m" in the main mark docs 2019-05-15 20:45:22 -03:00
monkeypatch.rst fix path expansion example 2019-05-27 23:23:18 -04:00
naming20.rst Updated documentation from txt to rst 2015-08-04 16:41:02 +05:30
nose.rst Add missing 'e' to test_mod(e). 2019-06-13 06:01:30 +02:00
parametrize.rst Remove all version references to obsolete pytest versions 2019-04-28 12:37:58 -03:00
plugins.rst -p option now can be used to early-load plugins by entry-point name 2019-02-24 13:20:17 -03:00
projects.rst Update all pypi.python.org URLs to pypi.org 2018-04-26 06:49:33 -07:00
py27-py34-deprecation.rst Fix link anchor 2019-06-01 23:27:20 +03:00
pytest.ini added "docs/en" directory and moved 2012-06-06 08:52:53 +09:00
pythonpath.rst Add documentation about python -m pytest invocation. 2017-10-18 21:30:56 +02:00
recwarn.rst Add docs for the warnings functionality 2017-03-20 23:35:01 -03:00
reference.rst Improve docs and reference 2019-06-26 19:15:00 -03:00
requirements.txt Pin sphinx-removed-in to >= 0.2.0 to support Sphinx 2.0 2019-03-15 10:56:13 +01:00
skipping.rst Run regendoc 2019-05-08 21:50:08 +00:00
talks.rst Add good talk by Andrew Svetlov 2019-02-15 15:37:18 +02:00
tidelift.rst Add link to tidelift to the main docs 2019-05-21 11:12:07 -03:00
tmpdir.rst Clean up u' prefixes and py2 bytes conversions 2019-06-04 17:50:34 -07:00
unittest.rst Preparing release version 4.4.1 2019-04-15 14:24:17 +00:00
usage.rst Merge pull request #5441 from nicoddemus/faulthandler-5440 2019-06-24 20:01:15 -03:00
warnings.rst Preparing release version 4.6.0 2019-05-31 23:12:57 -07:00
writing_plugins.rst Clean up __future__ and coding: in tests 2019-06-03 12:08:02 -03:00
xunit_setup.rst xunit-style functions and methods are invoked by autouse fixtures 2019-01-10 12:10:04 -02:00
yieldfixture.rst Remove all version references to obsolete pytest versions 2019-04-28 12:37:58 -03:00