Remove useless import
Fix qualitye flaws: reformat code for test and add cases