make sure str is a string
tests for API functions.