Add more tests and remove assert use TypeError instead.

rt