Since you have the file opened in the editor within PyCharm, you will see multiple green arrows to the left of your code, as illustrated here:
You might remember from Chapter 2, Installing and Configuring PyCharm, that by using a similar green arrow located at the beginning of the main scope of a Python program (the if __name__ == '__main__' condition), we can run the whole program. In general, these green arrows are indeed used to run, not just whole Python programs, but also code snippets and, in this case, unit tests. I personally like to call them run arrows.
As you click on any of these run arrows, a list of options will appear, displaying various actions you can have PyCharm perform with the code snippet that corresponds to that arrow:
For now, we can select the first option, Run 'Unittests for test_e...', to execute a specific test class or method. For example, when I chose the option to run the test_mul() method in the MathTest class, PyCharm executed that specific test method and opened the Run panel to display the output that's produced by the test. The following is my output after the execution:
Testing started at 14:17 ...
/usr/local/bin/python3.7 /Applications/PyCharm.app/Contents/helpers/pycharm/_jb_unittest_runner.py --target test_example.MathTest.test_mul
Launching unittests with arguments python -m unittest test_example.MathTest.test_mul in /Users/quannguyen/PycharmProjects/PyCharm-Book/Chapter06/Testing
Ran 1 test in 0.001s
OK
Process finished with exit code 0
Looking closely at the output, specifically the line that starts with Launching unittests..., we can see that PyCharm is acting as the middleman between the programmer and the command line. In particular, PyCharm specified that the argument that was used was python -m unittest test_example.MathTest.test_mul, which is the exact command we would use via the command line to execute the same test.
This is quite a useful feature: instead of having to type out the whole command in the command line, we can now simply visually locate the specific tests that we'd like to run and take advantage of the corresponding run arrows to execute them in PyCharm. This visual, graphical approach is also friendlier toward new Python programmers/testers.