Skip to content

Oct 09: Quiz3, Unit Testing with pytest

Learning Objectives

After today's class, you should be able to:

  • Install and run pytest on your computer.
  • Explain the role of assert in unit tests.
  • Write unit tests for both modules of PA1.

Announcements

Quiz 3

  • Two portions to the quiz: written and coding
  • Log in as student
  • Start exam recording
  • Log in to Canvas only
  • Raise your hand when complete with Canvas written portion
  • Open Thonny for coding portion only
  • Submit code through Canvas (will go to Gradescope)
  • Log out when finished

PA1 Introduction

Project 1

  • read instructions and code in detail before beginning

  • Unit testing (Week 8)

    • Part A due Tuesday 10/14
  • String methods (Week 9)
    • Part B due Tuesday 10/21 (before Fall Break)

Pytest Tutorial

Exercise

Installing/Running pytest

  • If you are absent today, complete this tutorial on your own
  • Be sure to submit your test_triangles.py via canvas

Note

Docstrings are not required for test functions. But you should still write a module docstring.

PA1 Introduction