@@ -44,7 +44,7 @@ Some general rules of testing:
44
44
45
45
- The first step when you are debugging your code is to write a new test
46
46
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.
48
48
49
49
- Use long and descriptive names for testing functions. The style guide here is
50
50
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
150
150
syntax. Creating a test suite is as easy as writing a module with a couple of
151
151
functions
152
152
153
- .. code-block :: console
153
+ .. code-block :: python
154
154
155
155
# content of test_sample.py
156
156
def func (x ):
@@ -181,8 +181,8 @@ and then running the `py.test` command
181
181
test_sample.py:5: AssertionError
182
182
========================= 1 failed in 0.02 seconds =========================
183
183
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!
186
186
187
187
`py.test <http://pytest.org/latest/ >`_
188
188
@@ -262,7 +262,7 @@ make assertions about how they have been used.
262
262
263
263
For example, you can monkey patch a method
264
264
265
- .. code-block :: console
265
+ .. code-block :: python
266
266
267
267
from mock import MagicMock
268
268
thing = ProductionClass()
@@ -275,7 +275,7 @@ To mock classes or objects in a module under test, use the ``patch`` decorator.
275
275
In the example below, an external search system is replaced with a mock that
276
276
always returns the same result (but only for the duration of the test).
277
277
278
- .. code-block :: console
278
+ .. code-block :: python
279
279
280
280
def mock_search (self ):
281
281
class MockSearchQuerySet (SearchQuerySet ):
0 commit comments