astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Astropy Testing helpers (`astropy.tests.helper`) »
- raises

# raises

class `astropy.tests.helper.``raises`(exc)

  Bases: `object`

  A decorator to mark that a test should raise a given exception. Use as follows:

      @raises(ZeroDivisionError)
      def test_foo():
          x = 1/0

  This can also be used a context manager, in which case it is just an alias for the `pytest.raises` context manager (because the two have the same name this help avoid confusion by being flexible).

  Methods Summary

  `__call__`(func) |

  Methods Documentation

  `__call__`(func)