def test_family_and_response_type_checks(formula_str, non_real_cols, family, priors): formula = parse(formula_str) cols = expand_columns(formula, non_real_cols) metadata = metadata_from_cols(cols) with pytest.raises(Exception, match='not compatible'): build_model_pre(formula, metadata, family, {})
def test_prior_checks(formula_str, non_real_cols, family, priors, expected_error): formula = parse(formula_str) cols = expand_columns(formula, non_real_cols) metadata = metadata_from_cols(cols) design_metadata = build_model_pre(formula, metadata, family, {}) with pytest.raises(Exception, match=expected_error): build_prior_tree(design_metadata, priors)
def makedesc(formula, metadata, family, priors, code_lengths): assert type(formula) == Formula assert type(metadata) == Metadata assert type(family) == Family assert type(priors) == list model_desc_pre = build_model_pre(formula, metadata, family, code_lengths) prior_tree = build_prior_tree(model_desc_pre, priors) return build_model(model_desc_pre, prior_tree)