Beispiel #1
0
 def test_add_scanner(self):
     """Test the ScannerBase add_scanner() method"""
     selector = ScannerBase({'.x': 1, '.y': 2})
     s = selector.select(self.skey_node('.z'))
     assert s is None, s
     selector.add_scanner('.z', 3)
     s = selector.select(self.skey_node('.z'))
     assert s == 3, s
Beispiel #2
0
    def test_select(self):
        """Test the ScannerBase select() method"""
        scanner = ScannerBase(function=self.func)
        s = scanner.select('.x')
        assert s is scanner, s

        selector = ScannerBase({'.x': 1, '.y': 2})
        s = selector.select(self.skey_node('.x'))
        assert s == 1, s
        s = selector.select(self.skey_node('.y'))
        assert s == 2, s
        s = selector.select(self.skey_node('.z'))
        assert s is None, s