Ejemplo n.º 1
0
    def test_empty_key(self):
        """Tests calling an empty key update."""

        test_config = mock_config.get_config()
        with self.assertRaises(ValueError):
            config_path.set_value('', test_config, None)
Ejemplo n.º 2
0
    def test_reading_setting_existing_key_in_dict(self):
        """Tests setting non existing key from dict inside config."""

        test_config = mock_config.get_config()
        with self.assertRaises(KeyError):
            config_path.set_value('dict.not_existing_key.key', test_config, 1)
Ejemplo n.º 3
0
    def test_list_out_of_range_set(self):
        """Tries to override out-of-range value in list."""

        test_config = mock_config.get_config()
        with self.assertRaises(IndexError):
            config_path.set_value('dict.list[2][1]', test_config, -1)
Ejemplo n.º 4
0
    def test_reading_non_existing_key(self):
        """Tests reading non existing key from config."""

        test_config = mock_config.get_config()
        with self.assertRaises(KeyError):
            config_path.set_value('dict.not_existing_key', test_config, 1)
Ejemplo n.º 5
0
 def parse(self, argument):  # pylint: disable=invalid-name
   value = self._parser.parse(argument)
   config_path.set_value(self._path, self._config, value)
   self._override_values[self._path] = value
   return value