Skip to content

OK-Formatted Test Cells vs. Exception-Based Test Cells #864

Closed Answered by chrispyles
vladtkachuk4 asked this question in Q&A
Discussion options

You must be logged in to vote

There are two main things to note about OK tests:

  • only the last line of a test cell may produce output; if other lines do things like print values, they must be ended with a semicolon
  • OK tests use doctests under the hood, so values are compared by comparing their reprs

You can find a brief guide on writing autograder tests, focusing on OK tests, here. It describes some of the common pitfalls of OK tests.

Besides these two things and the limitations of exception-based tests you mentioned, they both have the same capabilities. As long as you keep in mind the items above, I personally find OK tests more ergonomic.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vladtkachuk4
Comment options

Answer selected by chrispyles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants