Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Manually test the mymath module

We can create a command line application using the module

import mymath
import sys

if len(sys.argv) != 4:
    exit("Usage: {} [add|div] INT INT".format(sys.argv[0]))

if sys.argv[1] == 'add':
    print(mymath.add(int(sys.argv[2]), int(sys.argv[3])))
if sys.argv[1] == 'div':
    print(mymath.div(int(sys.argv[2]), int(sys.argv[3])))

And then we can ask our QA team to try it:

$ python src/examples/testing/good/run_mymath.py add 19 23
42
$ python src/examples/testing/good/run_mymath.py div 19 23
0.8260869565217391