original_docstring: Ensure that an attribute added to 'obj' during the test is
    removed when we're done
    
docstring: Ensure that an attribute added to 'obj' during the test is
  removed when we're done
docstring_tokens: Ensure that an attribute added to ' obj ' during the test is removed when we ' re done
code: def ensure_removed(obj, attr):
    """Ensure that an attribute added to 'obj' during the test is
    removed when we're done
    """
    try:
      yield
    finally:
      try:
        delattr(obj, attr)
        delattr(obj, f'has_{attr}')
      except AttributeError:
        pass
      obj._fields.discard(attr)
code_tokens: def ensure_removed ( obj , attr ) : try : yield finally : try : delattr ( obj , attr ) delattr ( obj , f'has_{attr}' ) except AttributeError : pass obj . _fields . discard ( attr )
short_docstring: Ensure that an attribute added to 'obj' during the test is
  removed when we're done
short_docstring_tokens: Ensure that an attribute added to ' obj ' during the test is removed when we ' re done
comment: """Ensure that an attribute added to 'obj' during the test is
    removed when we're done
    """