Use "inc" instead of "func" in the snipped on README and doc index

"inc" reads better, also fixed the line separators so
they have the same size
This commit is contained in:
Bruno Oliveira 2016-11-27 14:45:52 -02:00
parent 483754216f
commit 788e394c93
2 changed files with 20 additions and 22 deletions

View File

@ -24,31 +24,31 @@ An example of a simple test:
.. code-block:: python .. code-block:: python
# content of test_sample.py # content of test_sample.py
def func(x): def inc(x):
return x + 1 return x + 1
def test_answer(): def test_answer():
assert func(3) == 5 assert inc(3) == 5
To execute it:: To execute it::
$ pytest $ pytest
======= test session starts ======== ============================= test session starts =============================
collected 1 items collected 1 items
test_sample.py F test_sample.py F
======= FAILURES ======== ================================== FAILURES ===================================
_______ test_answer ________ _________________________________ test_answer _________________________________
def test_answer(): def test_answer():
> assert func(3) == 5 > assert inc(3) == 5
E assert 4 == 5 E assert 4 == 5
E + where 4 = func(3) E + where 4 = inc(3)
test_sample.py:5: AssertionError 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. 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.

View File

@ -14,33 +14,31 @@ An example of a simple test:
.. code-block:: python .. code-block:: python
# content of test_sample.py # content of test_sample.py
def func(x): def inc(x):
return x + 1 return x + 1
def test_answer(): def test_answer():
assert func(3) == 5 assert inc(3) == 5
To execute it:: To execute it::
$ pytest $ pytest
======= test session starts ======== ============================= 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:
collected 1 items collected 1 items
test_sample.py F test_sample.py F
======= FAILURES ======== ================================== FAILURES ===================================
_______ test_answer ________ _________________________________ test_answer _________________________________
def test_answer(): def test_answer():
> assert func(3) == 5 > assert inc(3) == 5
E assert 4 == 5 E assert 4 == 5
E + where 4 = func(3) E + where 4 = inc(3)
test_sample.py:5: AssertionError 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. Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used.
See :ref:`Getting Started <getstarted>` for more examples. See :ref:`Getting Started <getstarted>` for more examples.