Junior — Middle
Do you have experience writing tests using Pytest?
sobes.tech AI
Answer from AI
Yes, I have experience writing tests using Pytest. I used Pytest for writing unit and integration tests because of its simple syntax and powerful features such as fixtures and parameterization.
Example of a simple test with Pytest:
import pytest
def add(a, b):
return a + b
@pytest.mark.parametrize("a,b,expected", [
(1, 2, 3),
(0, 0, 0),
(-1, 1, 0),
])
def test_add(a, b, expected):
assert add(a, b) == expected
I also used fixtures for preparing test data and environment setup.