Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

alkaline-ml / statsmodels   python

Repository URL to install this package:

Version: 0.11.1 

/ tools / tests / test_testing.py

import pytest
import numpy as np

from statsmodels.tools.testing import ParamsTableTestBunch, \
    MarginTableTestBunch, Holder


@pytest.mark.parametrize('attribute, bunch_type',
                         (('params_table', ParamsTableTestBunch),
                          ('margins_table', MarginTableTestBunch)))
def check_params_table_classes(attribute, bunch_type):
    table = np.empty((10, 4))
    bunch = bunch_type(**{attribute: table})
    assert attribute in bunch


def test_bad_table():
    table = np.empty((10, 4))
    with pytest.raises(AttributeError):
        ParamsTableTestBunch(margins_table=table)


def test_holder():
    holder = Holder()
    holder.new_attr = 1
    assert hasattr(holder, 'new_attr')
    assert getattr(holder, 'new_attr') == 1