Book Image

Learning NumPy Array

By : Ivan Idris
Book Image

Learning NumPy Array

By: Ivan Idris

Overview of this book

Table of Contents (14 chapters)
Learning NumPy Array
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Assert functions


The NumPy testing package has a number of utility functions that test whether a precondition is true or not. The following table lists the NumPy assert functions:

Function

Description

assert_almost_equal

This raises an exception if two numbers are not equal up to a specified precision

assert_approx_equal

This raises an exception if two numbers are not equal up to a certain significance

assert_array_almost_equal

This raises an exception if two arrays are not equal up to a specified precision

assert_array_equal

This raises an exception if two arrays are not equal

assert_array_less

This raises an exception if two arrays do not have the same shape, and the elements of the first array are strictly less than the elements of the second array

assert_equal

This raises an exception if two objects are not equal

assert_raises

This fails if a specified exception is not raised by a callable function invoked with defined arguments

assert_warns

This fails...