# Path: clouddq/utils.py
# MAXIMUM_EXPONENTIAL_BACKOFF_SECONDS = 32
# def load_yaml(file_path: Path, key: str = None) -> typing.Any:
# def unnest_object_to_list(object: dict) -> list:
# def convert_json_value_to_dict(object: dict, key: str):
# def get_templates_path(file_path: Path) -> Path:
# def get_template_file(file_path: Path) -> str:
# def write_templated_file_to_path(path: Path, lookup_table: typing.Dict) -> None:
# def working_directory(path):
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
# def get_from_dict_and_assert(
#     config_id: str,
#     kwargs: typing.Dict,
#     key: str,
#     assertion: typing.Callable[[typing.Any], bool] = None,
#     error_msg: str = None,
# ) -> typing.Any:
# def get_keys_from_dict_and_assert_oneof(
#     config_id: str,
#     kwargs: typing.Dict,
#     keys: typing.List[str],
#     assertion: typing.Callable[[typing.Any], bool] = None,
#     error_msg: str = None,
# ) -> typing.Any:
# def load_jinja_template(template_path: Path) -> Template:
# def get_format_string_arguments(format_string: str) -> typing.List[str]:
# def strip_margin(text: str) -> str:
# def sha256_digest(text: str) -> str:
# def exponential_backoff(
#     retry_iteration: int, max_retry_duration: int = MAXIMUM_EXPONENTIAL_BACKOFF_SECONDS
# ):
# def make_archive(source, destination, keep_top_level_folder=True):
# def update_dict(dict1: dict, dict2: dict) -> dict:
# class DebugChainableUndefined(ChainableUndefined, DebugUndefined):


import logging
import pytest
from clouddq import utils
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.






logger = logging.getLogger(__name__)

class TestUtils:

    def test_get_keys_from_dict_and_assert_oneof(self):
        kwargs = {'a': 1, 'b': 2, 'c': 3}
        keys = ['a']
        value = utils.get_keys_from_dict_and_assert_oneof('exactly_one', kwargs=kwargs, keys=keys)
        assert value == {'a': 1}
        with pytest.raises(ValueError):
            utils.get_keys_from_dict_and_assert_oneof('none', kwargs=kwargs, keys=[])
        with pytest.raises(ValueError):

# Path: clouddq/utils.py
# MAXIMUM_EXPONENTIAL_BACKOFF_SECONDS = 32
# def load_yaml(file_path: Path, key: str = None) -> typing.Any:
# def unnest_object_to_list(object: dict) -> list:
# def convert_json_value_to_dict(object: dict, key: str):
# def get_templates_path(file_path: Path) -> Path:
# def get_template_file(file_path: Path) -> str:
# def write_templated_file_to_path(path: Path, lookup_table: typing.Dict) -> None:
# def working_directory(path):
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
# def get_from_dict_and_assert(
#     config_id: str,
#     kwargs: typing.Dict,
#     key: str,
#     assertion: typing.Callable[[typing.Any], bool] = None,
#     error_msg: str = None,
# ) -> typing.Any:
# def get_keys_from_dict_and_assert_oneof(
#     config_id: str,
#     kwargs: typing.Dict,
#     keys: typing.List[str],
#     assertion: typing.Callable[[typing.Any], bool] = None,
#     error_msg: str = None,
# ) -> typing.Any:
# def load_jinja_template(template_path: Path) -> Template:
# def get_format_string_arguments(format_string: str) -> typing.List[str]:
# def strip_margin(text: str) -> str:
# def sha256_digest(text: str) -> str:
# def exponential_backoff(
#     retry_iteration: int, max_retry_duration: int = MAXIMUM_EXPONENTIAL_BACKOFF_SECONDS
# ):
# def make_archive(source, destination, keep_top_level_folder=True):
# def update_dict(dict1: dict, dict2: dict) -> dict:
# class DebugChainableUndefined(ChainableUndefined, DebugUndefined):


# Path: tests/unit/test_utils.py
import logging
import pytest
from clouddq import utils

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.






logger = logging.getLogger(__name__)

class TestUtils:

    def test_get_keys_from_dict_and_assert_oneof(self):
        kwargs = {'a': 1, 'b': 2, 'c': 3}
        keys = ['a']
        value = utils.get_keys_from_dict_and_assert_oneof('exactly_one', kwargs=kwargs, keys=keys)
        assert value == {'a': 1}
        with pytest.raises(ValueError):
            utils.get_keys_from_dict_and_assert_oneof('none', kwargs=kwargs, keys=[])
        with pytest.raises(ValueError):

            utils.get_keys_from_dict_and_assert_oneof('two', kwargs=kwargs, keys=['a', 'b'])