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

Minor wording correction and changed some code-block tags to be python #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 12 docs/writing/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Some general rules of testing:

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

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

.. code-block:: console
.. code-block:: python

# content of test_sample.py
def func(x):
Expand Down Expand Up @@ -181,8 +181,8 @@ and then running the `py.test` command
test_sample.py:5: AssertionError
========================= 1 failed in 0.02 seconds =========================

far less work than would be required for the equivalent functionality with the
unittest module!
is far less work than would be required for the equivalent functionality with
the unittest module!

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

Expand Down Expand Up @@ -262,7 +262,7 @@ make assertions about how they have been used.

For example, you can monkey patch a method

.. code-block:: console
.. code-block:: python

from mock import MagicMock
thing = ProductionClass()
Expand All @@ -275,7 +275,7 @@ To mock classes or objects in a module under test, use the ``patch`` decorator.
In the example below, an external search system is replaced with a mock that
always returns the same result (but only for the duration of the test).

.. code-block:: console
.. code-block:: python

def mock_search(self):
class MockSearchQuerySet(SearchQuerySet):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.