Skip to content

Commit a827b87

Browse files
committed
pencil2: Update pytest fixtures and doctests
1 parent 9d974a8 commit a827b87

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

docs/document/arithmetic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def add(x, y):
99
def divide(x, y):
1010
"""Divides the first parameter by the second
1111
>>> x, y, z = 7, -6.0, 0
12-
>>> divide(x, y)
13-
-1.1666666666666667
12+
>>> round(divide(x, y), 8)
13+
-1.16666667
1414
>>> divide(x, z)
1515
Traceback (most recent call last):
1616
File "<stdin>", line 1, in <module>
@@ -21,15 +21,15 @@ def divide(x, y):
2121

2222
def multiply(x, y):
2323
"""
24-
>>> multiply(7,6)
24+
>>> multiply(7, 6)
2525
42
2626
"""
2727
return x * y
2828

2929

3030
def subtract(x, y):
3131
"""
32-
>>> subtract(7,6)
32+
>>> subtract(7, 6)
3333
1
3434
"""
3535
return x - y

docs/document/doctest.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ in a docstring or in another text file are fulfilled.
88

99
.. literalinclude:: arithmetic.py
1010
:language: python
11-
:lines: 9-18
11+
:lines: 9-19
1212
:lineno-start: 9
1313

1414
#. Then you can test it with:
@@ -28,12 +28,12 @@ in a docstring or in another text file are fulfilled.
2828
Expecting nothing
2929
ok
3030
Trying:
31-
divide(x, y)
31+
round(divide(x, y), 8)
3232
Expecting:
33-
-1.1666666666666667
33+
-1.16666667
3434
ok
3535
Trying:
36-
divide(x, z)
36+
divide(x, y)
3737
Expecting:
3838
Traceback (most recent call last):
3939
File "<stdin>", line 1, in <module>
@@ -75,9 +75,9 @@ in a docstring or in another text file are fulfilled.
7575
Expecting nothing
7676
ok
7777
Trying:
78-
divide(x, y)
78+
round(divide(x, y), 8)
7979
Expecting:
80-
-1.1666666666666667
80+
-1.16666667
8181
ok
8282
Trying:
8383
divide(x, z)

docs/test/pytest/fixtures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ And fixtures can also use several other fixtures:
529529
@pytest.fixture(scope="function")
530530
def populated_db(items_db, items_list):
531531
"""ItemsDB object populated with 'items_list'"""
532-
for i in some_items:
532+
for i in items_list:
533533
items_db.add_item(i)
534534
return items_db
535535

0 commit comments

Comments
 (0)