def test_Utils_AssertNPFArray_TestObjIs2DFloatArray(self): import numpy as np from opan.utils import assert_npfloatarray as a_npfa try: a_npfa(np.float_(np.array(range(6)).reshape((2, 3))), None, "1D float array", self.TestError, self.TestError.NONE, "No actual error; this should never be raised") except Exception: self.fail("Assertion failed on valid 2-D ndarray")
def test_Utils_AssertNPFArray_TestObjIs1DFloatArray(self): import numpy as np from opan.utils import assert_npfloatarray as a_npfa try: a_npfa(np.float_(np.array(range(5))), None, "1D Float array", self.TestError, self.TestError.NONE, "No actual error; this should never be raised") except Exception: self.fail("Assertion failed on valid 1-D ndarray")
def test_Utils_AssertNPFArray_TestVarIsFloatArray(self): import numpy as np from opan.utils import assert_npfloatarray as a_npfa class TestClass(object): import numpy as np testvar = np.float_(np.array(range(5))) try: a_npfa(TestClass, 'testvar', "Array member", self.TestError, self.TestError.NONE, "No actual error; this should never be raised") except Exception: self.fail("Assertion failed on a valid ndarray member")