Assert functions
Unit tests usually use functions, which assert something as part of the test. When doing numerical calculations, often we have the fundamental issue of trying to compare floating-point numbers that are almost equal. For integers, comparison is a trivial operation, but for floating-point numbers it is not because of the inexact representation by computers. The numpy.testing
package has a number of utility functions that test whether a precondition is true or not, taking into account the problem of floating-point comparisons:
Function |
Description |
---|---|
|
Raises an exception if two numbers are not equal up to a specified precision |
|
Raises an exception if two numbers are not equal up to a certain significance |
|
Raises an exception if two arrays are not equal up to a specified precision |
|
Raises an exception if two arrays are not equal |
|
Raises an exception if two... |