카테고리 없음
[Python] UnitTest 사용하기
SweetDev
2023. 2. 1. 16:31
Functions
assertEqual(a, b) | a == b | |
assertNotEqual(a, b) | a != b | |
assertTrue(x) | bool(x) is True | |
assertFalse(x) | bool(x) is False | |
assertIs(a, b) | a is b | 3.1 |
assertIsNot(a, b) | a is not b | 3.1 |
assertIsNone(x) | x is None | 3.1 |
assertIsNotNone(x) | x is not None | 3.1 |
assertIn(a, b) | a in b | 3.1 |
assertNotIn(a, b) | a not in b | 3.1 |
assertIsInstance(a, b) | isinstance(a, b) | 3.2 |
assertNotIsInstance(a, b) | not isinstance(a, b) | 3.2 |
METHOD DESCRIPTION
assertEqual(expected_value,actual_value) Asserts that expected_value == actual_value
assertTrue(result) Asserts that bool(result) is True
assertFalse(result) Asserts that bool(result) is False
assertRaises(exception, function, *args, **kwargs) Asserts that function(*args, **kwargs) raises the exception
Run
python -m unittest 파일명