# Path: sncosmo/utils.py
# def dict_to_array(d):
# def format_value(value, error=None, latex=False):
#     def __init__(self, *args, **kwargs):
#     def __getitem__(self, name):
#     def __getattr__(self, name):
#     def __repr__(self):
# def _integral_diff(x, pdf, a, q):
# def ppf(pdf, x, a, b):
#     def __init__(self, xmin, xmax, y):
#     def __call__(self, x):
# def _download_file(remote_url, target):
# def download_file(remote_url, local_name):
# def download_dir(remote_url, dirname):
#     def __init__(self, rootdir, remote_root):
#     def rootdir(self):
#     def _fetch_redirects(self):
#     def _get_url(self, remote_relpath):
#     def abspath(self, relpath, isdir=False):
# def alias_map(aliased, aliases, required=()):
# def integration_grid(low, high, target_spacing):
# def warn_once(name, depver, rmver, extra=None):
# class Result(dict):
# class Interp1D(object):
# class DataMirror(object):
#     FACTOR = 10.


import os
import numpy as np
import pytest
from tempfile import mkdtemp
from numpy.testing import assert_allclose
from scipy.stats import norm
from sncosmo import utils
# Licensed under a 3-clause BSD style license - see LICENSES





def test_result():
    res = utils.Result(a=1, b=2)
    assert res.a == 1
    assert res.b == 2

    # test deprecating result attributes
    res.__dict__['deprecated']['c'] = (2, "Use b instead")

    # for some reason, pytest 3.8 seems to not have warns
    if hasattr(pytest, 'warns'):
        with pytest.warns(UserWarning):
            val = res.c
    else:
        val = res.c


# Path: sncosmo/utils.py
# def dict_to_array(d):
# def format_value(value, error=None, latex=False):
#     def __init__(self, *args, **kwargs):
#     def __getitem__(self, name):
#     def __getattr__(self, name):
#     def __repr__(self):
# def _integral_diff(x, pdf, a, q):
# def ppf(pdf, x, a, b):
#     def __init__(self, xmin, xmax, y):
#     def __call__(self, x):
# def _download_file(remote_url, target):
# def download_file(remote_url, local_name):
# def download_dir(remote_url, dirname):
#     def __init__(self, rootdir, remote_root):
#     def rootdir(self):
#     def _fetch_redirects(self):
#     def _get_url(self, remote_relpath):
#     def abspath(self, relpath, isdir=False):
# def alias_map(aliased, aliases, required=()):
# def integration_grid(low, high, target_spacing):
# def warn_once(name, depver, rmver, extra=None):
# class Result(dict):
# class Interp1D(object):
# class DataMirror(object):
#     FACTOR = 10.


# Path: sncosmo/tests/test_utils.py
import os
import numpy as np
import pytest
from tempfile import mkdtemp
from numpy.testing import assert_allclose
from scipy.stats import norm
from sncosmo import utils

# Licensed under a 3-clause BSD style license - see LICENSES





def test_result():
    res = utils.Result(a=1, b=2)
    assert res.a == 1
    assert res.b == 2

    # test deprecating result attributes
    res.__dict__['deprecated']['c'] = (2, "Use b instead")

    # for some reason, pytest 3.8 seems to not have warns
    if hasattr(pytest, 'warns'):
        with pytest.warns(UserWarning):
            val = res.c
    else:
        val = res.c


    assert val == 2