| 1 | import unittest |
| 2 | |
| 3 | import skrf as rf |
| 4 | |
| 5 | |
| 6 | class HomoDictTest(unittest.TestCase): |
| 7 | """ |
| 8 | """ |
| 9 | def setUp(self): |
| 10 | self.h = rf.util.HomoDict({'a':'asdf','b':'ZZZZ'}) |
| 11 | |
| 12 | def test_get_item(self): |
| 13 | self.assertEqual(self.h['a'],'asdf') |
| 14 | |
| 15 | |
| 16 | def test_call(self): |
| 17 | self.assertEqual(self.h.upper()['a'],'ASDF') |
| 18 | |
| 19 | |
| 20 | def test_boolean_mask(self): |
| 21 | match_key = [key for key in self.h.keys() if self.h[key].startswith('a') ] |
| 22 | self.assertEqual(self.h[match_key], 'asdf') |
| 23 | |
| 24 | |
| 25 | class HomoListTest(unittest.TestCase): |
| 26 | """ |
| 27 | """ |
| 28 | def setUp(self): |
| 29 | self.h = rf.util.HomoList(['asdf','ZZZZ']) |
| 30 | |
| 31 | def test_get_item(self): |
| 32 | self.assertEqual(self.h[0],'asdf') |
| 33 | |
| 34 | |
| 35 | def test_call(self): |
| 36 | self.assertEqual(self.h.upper()[0],'ASDF') |
| 37 | |
| 38 | |
| 39 | def test_boolean_mask(self): |
| 40 | match_idx = [idx for idx in range(len(self.h)) if self.h.startswith('a')] |
| 41 | self.assertEqual(self.h[match_idx], 'asdf') |