Hide keyboard shortcuts

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

import unittest 

 

import numpy as np 

from numpy.testing import assert_allclose 

 

import astshim as ast 

from astshim.test import MappingTestCase 

 

 

class TestUnitMap(MappingTestCase): 

 

def test_UnitMapBasics(self): 

unitmap = ast.UnitMap(3) 

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

self.assertEqual(unitmap.nIn, 3) 

self.assertEqual(unitmap.nOut, 3) 

 

self.checkBasicSimplify(unitmap) 

self.checkCopy(unitmap) 

 

indata = np.array([ 

[1.1, 2.2, 3.3, 4.4], 

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

[0.0, -2.3, 44.4, 3.14], 

]) 

outdata = unitmap.applyForward(indata) 

assert_allclose(outdata, indata) 

self.checkRoundTrip(unitmap, indata) 

self.checkMappingPersistence(unitmap, indata) 

 

 

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

unittest.main()