test: improved type checking with regex
Removed generic check of TypeError and replaced with a regular expression of the expected error message.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test