<aside>
</aside>
==
) ์ธ ๋ค์ํ ๋น๊ต (>
, <
, in
, is
๋ฑ) ์ด์์
ํ์ฉpytest.approx
์ฌ์ฉ๋ฒ ์์งpytest.raises
์ฌ์ฉ๋ฒ ์ตํ๊ธฐpytest.warns
) ์๊ธฐํ๋ก์ ํธ ๊ตฌ์กฐ: (๋ณ๋ ์์)
graph TD
A(my-pytest-project) --> B(.venv);
A --> C(mycalc);
A --> D(tests);
C --> C1(__init__.py);
C --> C2(mycalc.py);
C --> C3(operations.py);
D --> D1(__init__.py);
D --> D2(test_mycalc.py);
D --> D3(test_operations.py);
D --> D4(test_calculator_class.py);
style B fill:#eee,stroke:#333,stroke-dasharray: 5 5;
style C fill:#ccf,stroke:#333;
style D fill:#cfc,stroke:#333;
style C3 fill:#cce,stroke:#333;
style D3 fill:#cef,stroke:#333;
style D4 fill:#fec,stroke:#333;
mycalc/operations.py
(๋๋์
ํจ์ ์ถ๊ฐ):tests/test_operations.py
(๋ค์ํ ์ด์์
๋ฐ ์์ธ ํ
์คํธ ์ถ๊ฐ):assert
ํ์ฉ๋ฒ ๐งassert
๋ฅผ ์ฌ์ฉ, ๋ค์ํ ์กฐ๊ฑด ๊ฒ์ฆ ๊ฐ๋ฅ.assert ์กฐ๊ฑด
, assert not ์กฐ๊ฑด
assert [1, 2, 3]
, assert not ""
0
, None
, ๋น ์ปฌ๋ ์
๋ฑ์ False
๋ก ํ๊ฐ.>
, <
, >=
, <=
, !=
assert item_count > 0
in
, not in
assert 'error' in log_message.lower()
is
, is not
==
์ ๋ค๋ฆ). ์ฃผ๋ก None
๋น๊ต, ์ฑ๊ธํค ๊ฐ์ฒด ํ์ธ์ ์ฌ์ฉ.assert result is None