인자로 받은 조건식이 거짓인 경우 AssertError가 발생
assert <조건식>, <관련 데이터>
def foo(x):
assert type(x) == int, "Input value must be integer"
return x * 10
ret = foo("a")
print(ret)
Traceback (most recent call last):
File "/Users/MGP/Documents/workspace/Python/src/testmodule/__init__.py", line 5, in <module>
ret = foo("a")
File "/Users/MGP/Documents/workspace/Python/src/testmodule/__init__.py", line 2, in foo
assert type(x) == int, "Input value must be integer"
AssertionError: Input value must be integer