Closed Jasha10 closed 2 years ago
This PR implements a default message for assert_isinstance.
assert_isinstance
Consider the following example:
# tmp.py from typing import Any import numpy as np from nptyping import NDArray, assert_isinstance my_arr = np.array([1, 2, 3], dtype=np.float32) assert_isinstance(my_arr, NDArray[Any, np.int64])
$ python tmp.py Traceback (most recent call last): ... AssertionError
The above offers little info as to what caused the failure.
$ python tmp.py Traceback (most recent call last): ... AssertionError: instance=array([1., 2., 3.], dtype=float32), cls=NDArray[Any, Int]
This should be enough to diagnose why the assertion failed.
Kudos, SonarCloud Quality Gate passed!
0 Bugs 0 Vulnerabilities 0 Security Hotspots 0 Code Smells
No Coverage information 0.0% Duplication
This PR implements a default message for
assert_isinstance
.Consider the following example:
Before the PR:
The above offers little info as to what caused the failure.
After the PR:
This should be enough to diagnose why the assertion failed.