File: test_util.py

package info (click to toggle)
scikit-rf 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 82,128 kB
  • sloc: python: 33,328; makefile: 130; sh: 19
file content (41 lines) | stat: -rw-r--r-- 946 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
40
41
import unittest

import skrf as rf


class HomoDictTest(unittest.TestCase):
    """
    """
    def setUp(self):
        self.h = rf.util.HomoDict({'a':'asdf','b':'ZZZZ'})

    def test_get_item(self):
        self.assertEqual(self.h['a'],'asdf')


    def test_call(self):
        self.assertEqual(self.h.upper()['a'],'ASDF')


    def test_boolean_mask(self):
        match_key = [key for key in self.h.keys() if self.h[key].startswith('a') ]
        self.assertEqual(self.h[match_key], 'asdf')


class HomoListTest(unittest.TestCase):
    """
    """
    def setUp(self):
        self.h = rf.util.HomoList(['asdf','ZZZZ'])

    def test_get_item(self):
        self.assertEqual(self.h[0],'asdf')


    def test_call(self):
        self.assertEqual(self.h.upper()[0],'ASDF')


    def test_boolean_mask(self):
        match_idx = [idx for idx in range(len(self.h)) if self.h.startswith('a')]
        self.assertEqual(self.h[match_idx], 'asdf')