Add TypeError if arg is not a string.

This commit is contained in:
voussoir 2021-08-17 13:48:57 -07:00
parent f5e5db1908
commit db8c6e42e3
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -122,6 +122,9 @@ def input(
So, your calling code should not have to make any adjustments -- just call So, your calling code should not have to make any adjustments -- just call
this function however is appropriate for your data sink and enjoy. this function however is appropriate for your data sink and enjoy.
''' '''
if not isinstance(arg, str):
raise TypeError(f'arg should be {str}, not {type(arg)}.')
arg_lower = arg.lower() arg_lower = arg.lower()
if arg_lower in INPUT_STRINGS: if arg_lower in INPUT_STRINGS: