Have you worked with mocks (test doubles)?
Asked at
AI answer
Yes. Mocks let you isolate the code under test from external dependencies—such as an API, database, or clock—and verify how the code interacts with them. In Python, I use unittest.mock (Mock, patch) or pytest with monkeypatch. For example, you can mock an HTTP call and check that it was made with the required parameters. I try not to mock internal implementation details unnecessarily: excessive mocking makes tests brittle.
Also asked at Бюро 1440
- What is GIL in CPython, how is it implemented, and why is it needed?
- What is an iterator and a generator, how do they differ?
- What are asynchronous, multithreading, and multiprocessing? How do they differ and when should each be used?
- Compare multithreading, multiprocessing, and asynchronous in Python: differences, advantages, and disadvantages.
- What are the key differences between synchronous and asynchronous programming in Python? Please answer this question orally.
Similar questions
- What did you use to write tests? Did you have test coverage, and what kinds of tests did you write?
- What kinds of automated tests have you written (unit, integration, e2e)? How did you isolate integration tests from the database when running them in parallel?
- What do you cover with integration tests?
- How many automated tests did you have for a component you wrote?
- Are you familiar with the Spec-driven development approach, and how do you understand it?