package np

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `NoseTester
]
type t = [ `NoseTester | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?package:[ `Module of Py.Object.t | `S of string ] -> ?raise_warnings: [ `Sequence_of_warnings of Py.Object.t | `S of string | `None ] -> ?depth:int -> ?check_fpu_mode:Py.Object.t -> unit -> t

Nose test runner.

This class is made available as numpy.testing.Tester, and a test function is typically added to a package's __init__.py like so::

from numpy.testing import Tester test = Tester().test

Calling this test function finds and runs all tests associated with the package and all its sub-packages.

Attributes ---------- package_path : str Full path to the package to test. package_name : str Name of the package to test.

Parameters ---------- package : module, str or None, optional The package to test. If a string, this should be the full path to the package. If None (default), `package` is set to the module from which `NoseTester` is initialized. raise_warnings : None, str or sequence of warnings, optional This specifies which warnings to configure as 'raise' instead of being shown once during the test execution. Valid strings are:

  • 'develop' : equals ``(Warning,)``
  • 'release' : equals ``()``, don't raise on any warnings.

Default is 'release'. depth : int, optional If `package` is None, then this can be used to initialize from the module of the caller of (the caller of (...)) the code that initializes `NoseTester`. Default of 0 means the module of the immediate caller; higher values are useful for utility routines that want to initialize `NoseTester` objects on behalf of other code.

val bench : ?label:[ `Full | `Fast | `T | `Attribute_identifier of Py.Object.t ] -> ?verbose:int -> ?extra_argv:[> `Ndarray ] Obj.t -> [> tag ] Obj.t -> bool

Run benchmarks for module using nose.

Parameters ---------- label : 'fast', 'full', '', attribute identifier, optional Identifies the benchmarks to run. This can be a string to pass to the nosetests executable with the '-A' option, or one of several special values. Special values are:

* 'fast' - the default - which corresponds to the ``nosetests -A`` option of 'not slow'. * 'full' - fast (as above) and slow benchmarks as in the 'no -A' option to nosetests - this is the same as ''. * None or '' - run all tests. * attribute_identifier - string passed directly to nosetests as '-A'.

verbose : int, optional Verbosity value for benchmark outputs, in the range 1-10. Default is 1. extra_argv : list, optional List with any extra arguments to pass to nosetests.

Returns ------- success : bool Returns True if running the benchmarks works, False if an error occurred.

Notes ----- Benchmarks are like tests, but have names starting with 'bench' instead of 'test', and can be found under the 'benchmarks' sub-directory of the module.

Each NumPy module exposes `bench` in its namespace to run all benchmarks for it.

Examples -------- >>> success = np.lib.bench() #doctest: +SKIP Running benchmarks for numpy.lib ... using 562341 items: unique: 0.11 unique1d: 0.11 ratio: 1.0 nUnique: 56230 == 56230 ... OK

>>> success #doctest: +SKIP True

val prepare_test_args : ?label:Py.Object.t -> ?verbose:Py.Object.t -> ?extra_argv:Py.Object.t -> ?doctests:Py.Object.t -> ?coverage:Py.Object.t -> ?timer:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Run tests for module using nose.

This method does the heavy lifting for the `test` method. It takes all the same arguments, for details see `test`.

See Also -------- test

val test : ?label:[ `Full | `Fast | `T | `Attribute_identifier of Py.Object.t ] -> ?verbose:int -> ?extra_argv:[> `Ndarray ] Obj.t -> ?doctests:bool -> ?coverage:bool -> ?raise_warnings:[ `Sequence_of_warnings of Py.Object.t | `S of string ] -> ?timer:[ `Bool of bool | `I of int ] -> [> tag ] Obj.t -> Py.Object.t

Run tests for module using nose.

Parameters ---------- label : 'fast', 'full', '', attribute identifier, optional Identifies the tests to run. This can be a string to pass to the nosetests executable with the '-A' option, or one of several special values. Special values are:

* 'fast' - the default - which corresponds to the ``nosetests -A`` option of 'not slow'. * 'full' - fast (as above) and slow tests as in the 'no -A' option to nosetests - this is the same as ''. * None or '' - run all tests. * attribute_identifier - string passed directly to nosetests as '-A'.

verbose : int, optional Verbosity value for test outputs, in the range 1-10. Default is 1. extra_argv : list, optional List with any extra arguments to pass to nosetests. doctests : bool, optional If True, run doctests in module. Default is False. coverage : bool, optional If True, report coverage of NumPy code. Default is False. (This requires the `coverage module <https://nedbatchelder.com/code/modules/coveragehtml>`_). raise_warnings : None, str or sequence of warnings, optional This specifies which warnings to configure as 'raise' instead of being shown once during the test execution. Valid strings are:

* 'develop' : equals ``(Warning,)`` * 'release' : equals ``()``, do not raise on any warnings. timer : bool or int, optional Timing of individual tests with ``nose-timer`` (which needs to be installed). If True, time tests and report on all of them. If an integer (say ``N``), report timing results for ``N`` slowest tests.

Returns ------- result : object Returns the result of running the tests as a ``nose.result.TextTestResult`` object.

Notes ----- Each NumPy module exposes `test` in its namespace to run all tests for it. For example, to run all tests for numpy.lib:

>>> np.lib.test() #doctest: +SKIP

Examples -------- >>> result = np.lib.test() #doctest: +SKIP Running unit tests for numpy.lib ... Ran 976 tests in 3.933s

OK

>>> result.errors #doctest: +SKIP >>> result.knownfail #doctest: +SKIP

val package_path : t -> string

Attribute package_path: get value or raise Not_found if None.

val package_path_opt : t -> string option

Attribute package_path: get value as an option.

val package_name : t -> string

Attribute package_name: get value or raise Not_found if None.

val package_name_opt : t -> string option

Attribute package_name: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.