# Path: sacred/optional.py
# def optional_import(*package_names):
# def get_tensorflow():
# 
# Path: sacred/config/utils.py
# def normalize_or_die(obj):
#     if isinstance(obj, dict):
#         res = dict()
#         for key, value in obj.items():
#             assert_is_valid_key(key)
#             res[key] = normalize_or_die(value)
#         return res
#     elif isinstance(obj, (list, tuple)):
#         return list([normalize_or_die(value) for value in obj])
#     return normalize_numpy(obj)


import pytest
from sacred import optional as opt
from sacred.config.utils import normalize_or_die



@pytest.mark.skipif(not opt.has_numpy, reason="requires numpy")
@pytest.mark.parametrize(
    "typename",
    [
        "bool_",
        "int_",
        "intc",
        "intp",
        "int8",
        "int16",
        "int32",
        "int64",
        "uint8",
        "uint16",
        "uint32",
        "uint64",
        "float_",
        "float16",
        "float32",
        "float64",
    ],
)
def test_normalize_or_die_for_numpy_datatypes(typename):
    dtype = getattr(opt.np, typename)
    assert normalize_or_die(dtype(7.0))



# Path: sacred/optional.py
# def optional_import(*package_names):
# def get_tensorflow():
# 
# Path: sacred/config/utils.py
# def normalize_or_die(obj):
#     if isinstance(obj, dict):
#         res = dict()
#         for key, value in obj.items():
#             assert_is_valid_key(key)
#             res[key] = normalize_or_die(value)
#         return res
#     elif isinstance(obj, (list, tuple)):
#         return list([normalize_or_die(value) for value in obj])
#     return normalize_numpy(obj)


# Path: tests/test_config/test_utils.py
import pytest
from sacred import optional as opt
from sacred.config.utils import normalize_or_die




@pytest.mark.skipif(not opt.has_numpy, reason="requires numpy")
@pytest.mark.parametrize(
    "typename",
    [
        "bool_",
        "int_",
        "intc",
        "intp",
        "int8",
        "int16",
        "int32",
        "int64",
        "uint8",
        "uint16",
        "uint32",
        "uint64",
        "float_",
        "float16",
        "float32",
        "float64",
    ],
)
def test_normalize_or_die_for_numpy_datatypes(typename):
    dtype = getattr(opt.np, typename)
    assert normalize_or_die(dtype(7.0))



@pytest.mark.skipif(not opt.has_numpy, reason="requires numpy")