Coverage for tests/test_zoomMap.py: 31%

23 statements  

« prev     ^ index     » next       coverage.py v7.2.1, created at 2023-03-12 01:17 -0800

1import unittest 

2 

3import numpy as np 

4from numpy.testing import assert_allclose 

5 

6import astshim as ast 

7from astshim.test import MappingTestCase 

8 

9 

10class TestZoomMap(MappingTestCase): 

11 

12 def test_basics(self): 

13 """Test basics of ZoomMap including applyForward 

14 """ 

15 for nin in (1, 2, 3): 

16 for zoom in (1.0, -1.1, 359.3): 

17 zoommap = ast.ZoomMap(nin, zoom) 

18 self.assertEqual(zoommap.className, "ZoomMap") 

19 self.assertEqual(zoommap.nIn, nin) 

20 self.assertEqual(zoommap.nOut, nin) 

21 self.assertTrue(zoommap.isLinear) 

22 

23 self.checkBasicSimplify(zoommap) 

24 self.checkCopy(zoommap) 

25 

26 indata = np.array([ 

27 [1.0, 2.0, -6.0, 30.0, 1.0], 

28 [3.0, 99.0, -5.0, 21.0, 0.0], 

29 [-5.0, 3.0, -7.0, 37.0, 0.0], 

30 [7.0, -23.0, -3.0, 45.0, 0.0], 

31 ], dtype=float)[0:nin] 

32 self.checkRoundTrip(zoommap, indata) 

33 self.checkMappingPersistence(zoommap, indata) 

34 

35 topos = zoommap.applyForward(indata) 

36 assert_allclose(indata * zoom, topos) 

37 

38 

39if __name__ == "__main__": 39 ↛ 40line 39 didn't jump to line 40, because the condition on line 39 was never true

40 unittest.main()