Add more type-checking tests

Also change exception type to TypeError