Skip to content

Commit

Permalink
Merge pull request #2095 from nicoddemus/readme-example
Browse files Browse the repository at this point in the history
Use "inc" instead of "func" in the snipped on README
  • Loading branch information
RonnyPfannschmidt authored Nov 27, 2016
2 parents 4837542 + 788e394 commit f25ba4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@ An example of a simple test:
.. code-block:: python
# content of test_sample.py
def func(x):
def inc(x):
return x + 1
def test_answer():
assert func(3) == 5
assert inc(3) == 5
To execute it::

$ pytest
======= test session starts ========
============================= test session starts =============================
collected 1 items

test_sample.py F

======= FAILURES ========
_______ test_answer ________
================================== FAILURES ===================================
_________________________________ test_answer _________________________________

def test_answer():
> assert func(3) == 5
> assert inc(3) == 5
E assert 4 == 5
E + where 4 = func(3)
E + where 4 = inc(3)

test_sample.py:5: AssertionError
======= 1 failed in 0.12 seconds ========
========================== 1 failed in 0.04 seconds ===========================


Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
Expand Down
26 changes: 12 additions & 14 deletions doc/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,31 @@ An example of a simple test:
.. code-block:: python
# content of test_sample.py
def func(x):
def inc(x):
return x + 1
def test_answer():
assert func(3) == 5
assert inc(3) == 5
To execute it::

$ pytest
======= test session starts ========
platform linux -- Python 3.5.2, pytest-3.0.4, py-1.4.31, pluggy-0.4.0
rootdir: $REGENDOC_TMPDIR, inifile:
============================= test session starts =============================
collected 1 items

test_sample.py F
======= FAILURES ========
_______ test_answer ________

================================== FAILURES ===================================
_________________________________ test_answer _________________________________

def test_answer():
> assert func(3) == 5
> assert inc(3) == 5
E assert 4 == 5
E + where 4 = func(3)
E + where 4 = inc(3)

test_sample.py:5: AssertionError
======= 1 failed in 0.12 seconds ========
========================== 1 failed in 0.04 seconds ===========================

Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used.
See :ref:`Getting Started <getstarted>` for more examples.
Expand Down

0 comments on commit f25ba4d

Please sign in to comment.