add testcases
use from keyword when raise exception, bugfixes
pep8