Junior — Middle
In your previous position, did you create or run automated tests for code checks?
sobes.tech AI
Answer from AI
Yes, in previous projects I have created and run automated tests for Python code using the unittest and pytest frameworks. This helped identify errors early and ensured the stability of the application when making changes.
Here's an example of a simple test using pytest:
# test_sample.py
def add(a, b):
return a + b
def test_add():
assert add(2, 3) == 5
assert add(-1, 1) == 0
Tests are run with the pytest command in the terminal, which automatically detects and executes all test functions.