Use assertRaises instead of catching exception