Interview quiz track

First 2 free Intermediate Python

Python – Testing

Practice Python testing interview questions covering unit tests, pytest, mocking, and test design. Write short test examples or explanations and receive feedback on correctness and best practices. Ideal for junior and mid-level developer interview prep. First 2 questions are free with full feedback.

  • Level Intermediate
  • Questions 12
  • Python
  • testing
  • intermediate
  • interview practice

Try any track free — first 2 questions include full AI feedback. Subscribe to finish the track and unlock everything. Type or speak your answer — the first 2 questions include scoring and detailed AI feedback.

Try first 2 questions free All tracks

Sample python – testing interview questions

Preview 6 questions from this track in quiz order. In the full quiz you answer one at a time — type or speak — then get a score and feedback.

  1. What is a unit test?

    What a strong answer includes

    Tests a small piece of code in isolation.

  2. How do you write a basic test in pytest?

    What a strong answer includes

    Function starting with test_ and an assert.

  3. What is the purpose of mocking?

    What a strong answer includes

    Isolates the unit under test from dependencies.

  4. Write a test for a function that adds two numbers.

    What a strong answer includes

    Correct assert.

  5. How do you test a function that raises an exception?

    What a strong answer includes

    Uses pytest.raises.

  6. What is a fixture in pytest?

    What a strong answer includes

    Reusable setup for tests.