Clean up generate_exception
Fix delete object tests to use assertRaises correctly