updated test code to doctest