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 6753406

Browse filesBrowse files
author
kuyan
committed
Declare code block language, fix formatting
1 parent 1a77f1b commit 6753406
Copy full SHA for 6753406

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+11
-11
lines changed

‎docs/writing/tests.rst

Copy file name to clipboardExpand all lines: docs/writing/tests.rst
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test suite runs.
112112

113113
A simple doctest in a function:
114114

115-
::
115+
.. code-block:: python
116116
117117
def square(x):
118118
"""Squares x.
@@ -142,15 +142,15 @@ py.test
142142

143143
py.test is a no-boilerplate alternative to Python's standard unittest module.
144144

145-
::
145+
.. code-block:: console
146146
147147
$ pip install pytest
148148
149149
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-
::
153+
.. code-block:: console
154154
155155
# content of test_sample.py
156156
def func(x):
@@ -161,7 +161,7 @@ functions
161161
162162
and then running the `py.test` command
163163

164-
::
164+
.. code-block:: console
165165
166166
$ py.test
167167
=========================== test session starts ============================
@@ -193,7 +193,7 @@ Nose
193193
nose extends unittest to make testing easier.
194194

195195

196-
::
196+
.. code-block:: console
197197
198198
$ pip install nose
199199
@@ -210,7 +210,7 @@ tox
210210
tox is a tool for automating test environment management and testing against
211211
multiple interpreter configurations
212212

213-
::
213+
.. code-block:: console
214214
215215
$ pip install tox
216216
@@ -227,14 +227,14 @@ API and better assertions over the one available in previous versions of Python.
227227

228228
If you're using Python 2.6 or below, you can install it with pip
229229

230-
::
230+
.. code-block:: console
231231
232232
$ pip install unittest2
233233
234234
You may want to import the module under the name unittest to make porting code
235235
to newer versions of the module easier in the future
236236

237-
::
237+
.. code-block:: python
238238
239239
import unittest2 as unittest
240240
@@ -253,7 +253,7 @@ mock
253253

254254
mock is a library for testing in Python.
255255

256-
::
256+
.. code-block:: console
257257
258258
$ pip install mock
259259
@@ -262,7 +262,7 @@ make assertions about how they have been used.
262262

263263
For example, you can monkey patch a method
264264

265-
::
265+
.. code-block:: console
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-
::
278+
.. code-block:: console
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.