rearrange the import location
use list comprehension instead of simple loop
add the raises exception and use  self.assertRaises to test for the exception raised.