Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b432c73

Browse filesBrowse files
author
Kenneth Reitz
committed
Merge pull request realpython#305 from Duta/patch-2
Minor wording correction and changed some code-block tags to be python
2 parents a0f6fc1 + 18c3e05 commit b432c73
Copy full SHA for b432c73

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎docs/writing/tests.rst

Copy file name to clipboardExpand all lines: docs/writing/tests.rst
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Some general rules of testing:
4444

4545
- The first step when you are debugging your code is to write a new test
4646
pinpointing the bug. While it is not always possible to do, those bug
47-
catching test are among the most valuable piece of code in your project.
47+
catching test are among the most valuable pieces of code in your project.
4848

4949
- Use long and descriptive names for testing functions. The style guide here is
5050
slightly different than that of running code, where short names are often
@@ -150,7 +150,7 @@ Despite being a fully-featured and extensible test tool, it boasts a simple
150150
syntax. Creating a test suite is as easy as writing a module with a couple of
151151
functions
152152

153-
.. code-block:: console
153+
.. code-block:: python
154154
155155
# content of test_sample.py
156156
def func(x):
@@ -181,8 +181,8 @@ and then running the `py.test` command
181181
test_sample.py:5: AssertionError
182182
========================= 1 failed in 0.02 seconds =========================
183183
184-
far less work than would be required for the equivalent functionality with the
185-
unittest module!
184+
is far less work than would be required for the equivalent functionality with
185+
the unittest module!
186186

187187
`py.test <http://pytest.org/latest/>`_
188188

@@ -262,7 +262,7 @@ make assertions about how they have been used.
262262

263263
For example, you can monkey patch a method
264264

265-
.. code-block:: console
265+
.. code-block:: python
266266
267267
from mock import MagicMock
268268
thing = ProductionClass()
@@ -275,7 +275,7 @@ To mock classes or objects in a module under test, use the ``patch`` decorator.
275275
In the example below, an external search system is replaced with a mock that
276276
always returns the same result (but only for the duration of the test).
277277

278-
.. code-block:: console
278+
.. code-block:: python
279279
280280
def mock_search(self):
281281
class MockSearchQuerySet(SearchQuerySet):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.