<jupyter_start><jupyter_text>Unit TestingTests are an essential part of good software. They ensure that your implementation does what it is supposed to do. They are also invaluable when making changes to existing code to see whether things break unexpectedly. Whenever you contribute code to ProbNum, make sure it is covered by appropriate tests. If you're unsure of what tests are or have never written a test before, check out this [basic guide](https://realpython.com/python-testing/) on testing in Python.  Running TestsProbNum's tests can be found in the folder `./tests`. To run the entire test suite, we recommend using `tox`. ToxTo run the tests using Tox, simply execute```bashtox -e py3```This runs the tests for your version of Python 3. You can also run the tests against a specific Python version, e.g. `tox -e py36` for Python 3.6.For more information on `tox`, check out the [general development instructions](../development/pull_request.md). PyTestProbNum uses `pytest` as a test runner. You can also run the tests directly by installing (`pip install pytest`) and executing```bashpytest```in the `./tests` directory. Using an IDEIf you are using an IDE such as PyCharm or VSCode, you can for example use the graphic interface to run single tests. This can be very convenient when writing tests. To set up your IDE to run `pytest`, check out the following guides:- PyCharm: https://www.jetbrains.com/help/pycharm/pytest.html- VSCode: https://code.visualstudio.com/docs/python/testing_enable-a-test-framework<jupyter_code>from IPython.display import Image

display(Image(url='https://code.visualstudio.com/assets/docs/python/testing/editor-adornments-pytest.png', 
              embed=True))<jupyter_output><empty_output><jupyter_text>The `pytest` FrameworkProbNum uses [pytest](https://docs.pytest.org/) as its testing framework. Writing a Unit TestA test is a simple function which checks whether your code does what it issupposed to. Whenever you find yourself running a snippet of code to check whether yourimplementation works, you should probably write a test. Here is a simple example.<jupyter_code>def add(x, y):
    return x + y

def test_symmetric():
    assert add(3, 5) == add(5, 3)<jupyter_output><empty_output><jupyter_text>Often we want to run a test for different combinations ofparameters. You can do so by parametrizing tests via a decorator.<jupyter_code>import pytest

@pytest.mark.parametrize("x,y", [(3, 5), (-1, 1), (0, 1.2)])
def test_symmetric(x, y):
    assert add(x, y) == add(y, x)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08927173061863743, 'fraction_numerical': 0.006656225528582615, 'mean_word_length': 4.860091743119266, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '220170', 'license': 'MIT', 'n_tokens_mistral': 757, 'n_tokens_neox': 719, 'n_words': 320, 'path': 'docs/source/development/unit_testing.ipynb', 'repo_name': 'christopheroates/probnum', 'size': '2554'}