Use assertRaises instead of a try/except block