Coverage for tests/test_unitMap.py: 41%

Shortcuts 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

20 statements  

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 TestUnitMap(MappingTestCase): 

11 

12 def test_UnitMapBasics(self): 

13 unitmap = ast.UnitMap(3) 

14 self.assertEqual(unitmap.className, "UnitMap") 

15 self.assertEqual(unitmap.nIn, 3) 

16 self.assertEqual(unitmap.nOut, 3) 

17 

18 self.checkBasicSimplify(unitmap) 

19 self.checkCopy(unitmap) 

20 

21 indata = np.array([ 

22 [1.1, 2.2, 3.3, 4.4], 

23 [-43.5, 1309.31, 0.005, -36.5], 

24 [0.0, -2.3, 44.4, 3.14], 

25 ]) 

26 outdata = unitmap.applyForward(indata) 

27 assert_allclose(outdata, indata) 

28 self.checkRoundTrip(unitmap, indata) 

29 self.checkMappingPersistence(unitmap, indata) 

30 

31 

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

33 unittest.main()