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 `MagicMock`, and how does it differ from a plain `Mock`?

Questions in this quiz
  1. What is `MagicMock`, and how does it differ from a plain `Mock`?
  2. How do you run `unittest` tests from the command line?
  3. What is the difference between `setUp`/`tearDown` and `setUpClass`/`tearDownClass`?
  4. What is the purpose of `unittest.mock.patch`?
  5. What is the purpose of a "test fixture" in the context of unittest?
  6. What is the difference between `assertEqual` and using a plain `assert` statement in a unittest test?
  7. What is `unittest`?
  8. What happens when a test method raises an unexpected exception that is NOT explicitly asserted against with `assertRaises`?
  9. What is the purpose of the `@unittest.skip` decorator?
  10. What is a key limitation of `unittest` compared to `pytest`, a popular third-party alternative?
  11. How does test discovery (`python -m unittest discover`) find test files by default?
  12. What is the purpose of the `setUp` method on a `TestCase`?
Gaps to close?
Read the curated unittest notes — core concepts, patterns, interview prep.
unittest notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web