def test_error_when_index_is_not_an_integer(self, path, failing_index): with pytest.raises(ValueError) as error: split_path(path, self.key_separator) expected_error = ValueError( f"Unable to access item '{failing_index}' in key '{path}': " "you can only provide integers to access list items.") assert str(error.value) == str(expected_error)
def test_error_when_missing_brackets(self, path): with pytest.raises(ValueError) as error: split_path(path, self.key_separator) expected_error = ValueError(f"Key '{path}' is badly formated.") assert str(error.value) == str(expected_error)
def test_split_path(self, path, result): assert split_path(path, self.key_separator) == result