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""" 

2Test code for ObjectFlags class. 

3""" 

4from collections import OrderedDict 

5import unittest 

6from lsst.sims.GalSimInterface import ObjectFlags 

7 

8class ObjectFlagsTestCase(unittest.TestCase): 

9 """Test case class for ObjectFlags.""" 

10 def setUp(self): 

11 pass 

12 

13 def tearDown(self): 

14 pass 

15 

16 def test_ObjectFlags(self): 

17 """Unit test for ObjectFlags class.""" 

18 conditions = OrderedDict([(condition, index) for index, condition 

19 in enumerate('abcde')]) 

20 flags = ObjectFlags(conditions=list(conditions.keys())) 

21 for condition, index in conditions.items(): 

22 flags.set_flag(condition) 

23 self.assertEqual(2**index, flags.value) 

24 flags.unset_flag(condition) 

25 self.assertEqual(0, flags.value) 

26 

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

28 unittest.main()