Use assert_raises instead.