Week 6 Flashcards
1
Q
How much test is there typically as compared to code?
A
2-4 times
2
Q
How do you run a doctest in Python?
A
Python -m doctest -vv <filename></filename>
3
Q
What are the four ways to run a pytest?
A
- pytest
- python -m pytest -vv
- pytest <filename></filename>
- pytest <filename>::<testname></testname></filename>
4
Q
How do you name a pytest file?
A
With test_ at the beginning or _test at the end
5
Q
How do you test that code raises an error with pytest?
A
with pytest.raises(<error>)
Code to raise error</error>
6
Q
What is floating point number error and what is one way to address it?
A
It is when the floating point has trailing numbers that do not match the expected value.
With the approx() function