Skip to content
Open
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
4 changes: 2 additions & 2 deletions website/content/07_programs_libraries_modules/55_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def multiply(x, y):
return x * y
```

Easy enough. Let's write a test case for it. Usually this will be broken out into a separate file, but we'll combine them for this contrived example. We'll create a `TestMultiply` class that derives from `unittest.TestCase`, with a method inside that does the actual testing. Lastly, we'll call `unittest.main()` to tell `unittest` to find and run our TestCase. We'll put all this in a file called `test_multiply.py` and run it from the command line:
Easy enough. Let's write a test case for it. Usually this will be broken out into separate files, but we'll combine them for this contrived example. We'll create a `TestMultiply` class that derives from `unittest.TestCase`, with a method inside that does the actual testing. Lastly, we'll call `unittest.main()` to tell `unittest` to find and run our TestCase. We'll put all this in a file called `test_multiply.py` and run it from the command line:

```python
# test_multiply.py
Expand Down Expand Up @@ -218,4 +218,4 @@ Subclassing the TestCase class gives you a bunch of useful assertions that you c

### Growing your Tests

Standard `unittest` tests are fine for most projects. As your programs grow and organization becomes more complex, you might want to consider an alternative testing framework or test runner. The 3rd party `nose2` and `pytest` modules are compatible with `unittest` but do things slightly differently. You can find more information in the [nose2 documentation](https://nose2.readthedocs.io/en/latest/) and [pytest documentation](https://docs.pytest.org/en/latest/).
Standard `unittest` tests are fine for most projects. As your programs grow and organization becomes more complex, you might want to consider an alternative testing framework or test runner. The 3rd party `nose2` and `pytest` modules are compatible with `unittest` but do things slightly differently. You can find more information in the [nose2 documentation](https://nose2.readthedocs.io/en/latest/) and [pytest documentation](https://docs.pytest.org/en/latest/).