We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decorators.py
decorators
pytest
# test_decorators.py import pytest from decorators import get_input def test_valid_input(monkeypatch): monkeypatch.setattr('builtins.input', lambda _: "25") assert get_input("Enter your age: ") == "25" def test_invalid_input(monkeypatch): monkeypatch.setattr('builtins.input', lambda _: "abc") with pytest.raises(ValueError): get_input("Enter your age: ")
tests/test_decorators.py
monkeypatch
input()
The text was updated successfully, but these errors were encountered:
maryjess
No branches or pull requests
decorators
tests/test_decorators.py 👉🏻👉🏻
pytest
is used here!tests/test_decorators.py
has the unit tests usingpytest
withmonkeypatch
to mock theinput()
function.The text was updated successfully, but these errors were encountered: