typing.assert_type(val, typ, /) 呼び出しをチェックして、val の推論される型が typ でないケースを報告します。
typing.assert_type(val, typ, /)
val
typ
例:
def greet(name: str) -> None: assert_type(name, str) # OK assert_type(name, int) # 推論される型 'int' が必要ですが、'str' を代わりに取得しました