Coverage for tests/test_shiftMap.py: 42%
22 statements
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-15 09:29 +0000
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-15 09:29 +0000
1import unittest
3import numpy as np
4from numpy.testing import assert_allclose
6import astshim as ast
7from astshim.test import MappingTestCase
10class TestShiftMap(MappingTestCase):
12 def test_ShiftMapBasics(self):
13 offset = np.array([1.1, -2.2, 3.3])
14 shiftmap = ast.ShiftMap(offset)
15 self.assertEqual(shiftmap.className, "ShiftMap")
16 self.assertEqual(shiftmap.nIn, 3)
17 self.assertEqual(shiftmap.nOut, 3)
19 self.checkBasicSimplify(shiftmap)
20 self.checkCopy(shiftmap)
22 indata = np.array([
23 [1.1, -43.5],
24 [2.2, 1309.31],
25 [3.3, 0.005],
26 ])
27 outdata = shiftmap.applyForward(indata)
28 pred_outdata = (indata.T + offset).T
29 assert_allclose(outdata, pred_outdata)
30 self.checkRoundTrip(shiftmap, indata)
31 self.checkMappingPersistence(shiftmap, indata)
34if __name__ == "__main__": 34 ↛ 35line 34 didn't jump to line 35, because the condition on line 34 was never true
35 unittest.main()