All quizzes
Free quiz · 21 questions in the bank

unittest quiz

Test your unittest knowledge with a free interactive quiz — 21 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is the purpose of `Mock` objects (from `unittest.mock`), independent of `patch`?

Questions in this quiz
  1. What is the purpose of `Mock` objects (from `unittest.mock`), independent of `patch`?
  2. What is the difference between `setUp`/`tearDown` and `setUpClass`/`tearDownClass`?
  3. What is the purpose of a "test fixture" in the context of unittest?
  4. How do you run `unittest` tests from the command line?
  5. What is the purpose of `unittest.mock.patch`?
  6. What is `unittest`?
  7. What does `assertIn` check?
  8. How does test discovery (`python -m unittest discover`) find test files by default?
  9. How do you define a test case in `unittest`?
  10. What is the purpose of the `@unittest.skip` decorator?
  11. What is `MagicMock`, and how does it differ from a plain `Mock`?
  12. What is the purpose of `tearDown`, and when does it run relative to a test method?
Gaps to close?
Read the curated unittest notes — core concepts, patterns, interview prep.
unittest notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web