using doctest

I think  it  is better to use doctest module to test code