Week 6 Flashcards

1
Q

How much test is there typically as compared to code?

A

2-4 times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you run a doctest in Python?

A

Python -m doctest -vv <filename></filename>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the four ways to run a pytest?

A
  1. pytest
  2. python -m pytest -vv
  3. pytest <filename></filename>
  4. pytest <filename>::<testname></testname></filename>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you name a pytest file?

A

With test_ at the beginning or _test at the end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you test that code raises an error with pytest?

A

with pytest.raises(<error>)
Code to raise error</error>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly