Search Header Logo
unittest

unittest

Assessment

Presentation

Computers

University

Medium

Created by

Michelle Craig

Used 5+ times

FREE Resource

4 Slides • 3 Questions

1

unittest

by Michelle Craig

2

Multiple Choice

A Python statement inside the if __name__ == '__main__' block of file prog.py:

1

is executed only when we directly run prog.py not when prog.py is imported.

2

is executed only when we import prog.py into another Python program.

3

is executed whenever prog.py is evaluated which means whenever we import prog.py or whenever we run prog.py

4

is only executed if we explicitly define a variable __name__ and set it to refer to the string '__main__'

3

4

Fill in the Blanks

Type answer...

5

​Automatically running the docstring examples

You can avoid cutting and pasting each example into the shell by using:

​import doctest

​doctest.testmod()

​You could put this in the if __name__ = '__main__' block

6

Open Ended

The prepare videos on test cases discussed 4 factors for consideration when creating a suite of tests. Give one of them.

7

​Selecting a Good Test Suite

  • ​Size or number

  • ​Order (or placement)

  • ​Dichotomies

  • ​Thresholds (or boundaries)

unittest

by Michelle Craig

Show answer

Auto Play

Slide 1 / 7

SLIDE