Listing 6-4. calculator.py
class Calculator:
def add(self, x, y):
return x+y
You can run the test module again. Here is the output:
============================= test session starts =============================
platform linux -- Python 3.4.2, pytest-3.0.4, py-1.4.31, pluggy-0.4.0 --
/usr/bin/python3
cachedir: .cache
rootdir: /home/pi/book/code/chapter06, inifile:
collected 1 items
test_module01.py::TestClass01::test_case01 PASSED
========================== 1 passed in 0.08 seconds ===========================
Now you can add more test cases to the test module (as shown in Listing
6-5
) to
check for more features,
Do'stlaringiz bilan baham: |