test_mathy.py
python_old/pytest-workshop/pytest-workshop-starter/tests/test_mathy.py
import pytest
from src.mathy import add, div, reciprocal
def test_add():
assert add(2, 3) == 5
def test_division_by_zero_type_and_message():
with pytest.raises(ValueError, match="non-zero"):
div(1, 0)
def test_sum_with_fixture(numbers):
assert sum(numbers) == 10
# TODO: Exercise A
# 1) Implement subtract(a,b) in src/mathy.py
# 2) Add a new test here to assert subtract(3,5) == -2
# from src.mathy import subtract
# def test_subtract_negative():
# assert subtract(3, 5) == -2
관련 글
01_classical_caesar_cipher.py
01_classical_caesar_cipher.py — python source code from the python old learning materials (python_old/Cryptography/01_classical_caesar_cipher.py).
글 읽기 →02_classical_monoalphabetic.py
02_classical_monoalphabetic.py — python source code from the python old learning materials (python_old/Cryptography/02_classical_monoalphabetic.py).
글 읽기 →03_classical_rail_fence.py
03_classical_rail_fence.py — python source code from the python old learning materials (python_old/Cryptography/03_classical_rail_fence.py).
글 읽기 →04_frequency_analysis.py
04_frequency_analysis.py — python source code from the python old learning materials (python_old/Cryptography/04_frequency_analysis.py).
글 읽기 →05_cryptographic_hashing.py
05_cryptographic_hashing.py — python source code from the python old learning materials (python_old/Cryptography/05_cryptographic_hashing.py).
글 읽기 →06_password_hashing.py
06_password_hashing.py — python source code from the python old learning materials (python_old/Cryptography/06_password_hashing.py).
글 읽기 →