assert语法用于判断代码是否符合执行预期
def test_asset(name, age):
assert type(name) is str
assert type(age) is int
print(name, age)
test_asset("黑子", 15)
print("-----------------")
test_asset(15, "黑子")
输出
assert语法用于判断代码是否符合执行预期
def test_asset(name, age):
assert type(name) is str
assert type(age) is int
print(name, age)
test_asset("黑子", 15)
print("-----------------")
test_asset(15, "黑子")
输出