Nose tests decorators

A nose is an organ above the mouth that is used by humans and animals to breathe and smell. It is also a Python framework that makes (unit) testing easier. Nose helps you organize tests. According to the nose documentation: "any python source file, directory, or package that matches the testMatch regular expression (by default: (?:^|[b_.-])[Tt]est) will be collected as a test". Nose makes extensive use of decorators. Python decorators are annotations that indicate something about a method or a function. The numpy.testing module has a number of decorators:

Decorator

Description

numpy.testing.decorators.deprecated

Filters deprecation warnings when running tests.

numpy.testing.decorators.knownfailureif

Raises KnownFailureTest exception based on a condition.

numpy.testing.decorators.setastest

Marks a function as being a test or not being a test.

numpy.testing.decorators.skipif

Raises SkipTest exception based on a condition.

numpy.testing.decorators.slow

Labels test functions or methods as slow.

Additionally we can call the decorate_methods function to apply decorators on methods of a class matching a regular expression or a string.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.203.68