Coverage for navipy/processing/test.py : 73%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
'navipy', 'resources/database.db')
""" this test checks that the correct errors are raised if wrong values for the input parameters are passed to the function scene of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: missing entries in the posorient pd.series None, NaN values in the posorient pd.series posorient is of wrong type (dictionary instead of pd.series) empty posorient pd.series """ # print("shape",image.shape)
# incorrect case missing column
# incorrect case None
# incorrect case nan
# incorrect case no pandas series but dict
# not working case empty
""" this test checks that the correct errors are raised if wrong values for the input parameters are passed to the function skyline_scene of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN values in the the scene scene is of wrong type (np.array) scene is of wrong size """
# contains nan # np.array instead of # wrong size
# should be working -> check if result(skyline) is correct # self.assertFalse(np.any(np.isNone(skyline)))
""" this test checks that the correct errors are raised if wrong values for the input parameters id of the function scene of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: zero and negative id char for the id None for the id NaN for the id float for the id """ # print("rowid",rowid)
# working cases # image=np.array(image)
""" this test checks that the correct errors are raised if wrong values for the input parameters distance_channel is passed to the function scene of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN, float, char values in the for the distance channel negative int for the distance channel """
# should not be working distance_channel=d) distance_channel=-1)
# should work pcode.contrast_weighted_nearness(scene, distance_channel=d) # print("last channel",d)
""" this test checks that the correct errors are raised if wrong values for the input parameter scene is passed to the function contr_weight_scene of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN values in the the scene scene is of wrong type (np.array) scene is of wrong size """
# working cases
# not working case
""" this test checks that the correct errors are raised if wrong values for the input parameter contrast_size are passed to the function skyline_scene of the navipy.database module. correct values are in the range between 2 and 5. it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN values, chars, floats for the contrast_size int values that are out of range (<2;>5) """ scene, contrast_size=size) pcode.contrast_weighted_nearness( scene, contrast_size=size)
# working cases contrast_size=size)
""" this test checks that the correct errors are raised if wrong values for the input parameter direction is passed to the function pcv of the navipy.database module. correct values are in the range between 2 and 5. it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: wrong shape (must match the scenes shape) last dimension shape does not match (must 2, azimuth, elevation) direction has too many dimensions is empty contains wrong values (None, nan) """ # working case self.assertIsNotNone(my_pcv) self.assertFalse(sum(my_pcv.shape) == 0) self.assertTrue(len(my_pcv.shape) == 4) self.assertFalse(np.any(np.isnan(my_pcv))) self.assertTrue(my_pcv.shape[3] == 3) self.assertTrue(my_pcv.shape[2] == 4) self.assertTrue(my_pcv.shape[0] > 0) self.assertTrue(my_pcv.shape[1] > 0)
# not working cases doesnt match with shape of place code testdirection = np.zeros((2, 4, 2)) with self.assertRaises(Exception): my_pcv = pcode.pcv(my_scene, testdirection)
# not working cases wrong last dimension testdirection = np.zeros((180, 360, 1)) with self.assertRaises(Exception): my_pcv = pcode.pcv(my_scene, testdirection)
# not working cases too many dimensions testdirection = np.zeros((180, 360, 2, 4)) with self.assertRaises(Exception): my_pcv = pcode.pcv(my_scene, testdirection)
# not working cases empty testdirection = np.zeros(()) with self.assertRaises(Exception): my_pcv = pcode.pcv(my_scene, testdirection)
# not working cases nans testdirection = np.zeros((180, 360, 2, 4)) testdirection[2, 3, 0] = np.nan with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirection)
# test if error is throught for elevation or azimuth out of range # check elevation, should be in [-pi*2;pi*2] testdirections = np.zeros((180, 360, 2)) testdirections[10, 15, 0] = -np.pi * 2 - 0.001 with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirections)
testdirections = np.zeros((180, 360, 2)) testdirections[10, 15, 0] = np.pi * 2 + 0.001 with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirections)
# check azimuth, should be in [-2*pi;2*pi] testdirections = np.zeros((180, 360, 2)) testdirections[10, 15, 1] = -2 * np.pi - 0.001 with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirections)
testdirections = np.zeros((180, 360, 2)) testdirections[10, 15, 1] = 2 * np.pi + 0.001 with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirections)
testdirections = np.zeros((180, 360, 2)) testdirections[10, 15, 1] = np.pi + 0.001 testdirections[10, 16, 1] = - np.pi - 0.001 with self.assertRaises(ValueError): my_pcv = pcode.pcv(my_scene, testdirections)
""" this test checks that the correct errors are raised if wrong values for the input parameter direction is passed to the function apcv of the navipy.database module. correct values are in the range between 2 and 5. it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: wrong shape (must match the scenes shape) last dimension shape does not match (must 2, azimuth, elevation) direction has too many dimensions is empty contains wrong values (None, nan) """ # working case
self.assertIsNotNone(my_pcv) self.assertFalse(sum(my_pcv.shape) == 0) self.assertTrue(len(my_pcv.shape) == 4) self.assertFalse(np.any(np.isnan(my_pcv))) self.assertTrue(my_pcv.shape[3] == 3) self.assertTrue(my_pcv.shape[2] == 4) self.assertTrue(my_pcv.shape[0] == 1) self.assertTrue(my_pcv.shape[1] == 1)
# not working cases doesnt match with shape of place code testdirection = np.zeros((2, 4, 2)) with self.assertRaises(Exception): my_pcv = pcode.apcv(my_scene, testdirection)
# not working cases wrong last dimension testdirection = np.zeros((180, 360, 1)) with self.assertRaises(Exception): my_pcv = pcode.apcv(my_scene, testdirection)
# not working cases too many dimensions testdirection = np.zeros((180, 360, 2, 4)) with self.assertRaises(Exception): my_pcv = pcode.apcv(my_scene, testdirection)
# not working cases empty testdirection = np.zeros(()) with self.assertRaises(Exception): my_pcv = pcode.apcv(my_scene, testdirection)
# not working cases nans testdirection = np.zeros((180, 360, 2, 4)) testdirection[2, 3, 0] = np.nan with self.assertRaises(ValueError): my_pcv = pcode.apcv(my_scene, testdirection)
""" this test checks that the correct errors are raised if wrong values for the input parameter size are passed to the function michelson_contrast of the navipy.database module. correct values are in the range between 2 and 5. it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN values, chars, floats for the contrast_size int values that are out of range (<2;>5) """ # not working cases:
scene, size=size) scene, size=size)
# working cases
""" this test checks that the correct errors are raised if wrong values for the input parameter scene is passed to the function michelson_contrast of the navipy.database module it also contains some test where correct parameter values were passed to the scene function and the output was checked for correctness. test cases: None, NaN values in the the scene scene is of wrong type (np.array) scene is of wrong size """
# working cases
# not working case
unittest.main() |