-
Notifications
You must be signed in to change notification settings - Fork 11
/
conftest.py
81 lines (57 loc) · 1.84 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import pytest
import statsmodels.formula.api as smf
import polars as pl
diamonds = pl.read_csv("tests/data/diamonds.csv")
dietox = pl.read_csv("tests/data/dietox.csv")
guerry = pl.read_csv(
"tests/data/Guerry.csv",
null_values="NA",
).drop_nulls()
guerry_with_nulls = pl.read_csv("tests/data/Guerry.csv")
impartiality_df = pl.read_csv("tests/data/impartiality.csv").with_columns(
pl.col("impartial").cast(pl.Int8)
)
iris = pl.read_csv("tests/data/iris.csv")
mtcars_df = pl.read_csv("tests/data/mtcars.csv")
penguins = pl.read_csv(
"tests/data/penguins.csv",
null_values="NA",
).drop_nulls()
quine = pl.read_csv("tests/data/quine.csv")
@pytest.fixture(scope="session")
def mtcars():
return pl.read_csv("tests/data/mtcars.csv")
return mtcars
@pytest.fixture(scope="session")
def guerry_mod():
return smf.ols("Literacy ~ Pop1831 * Desertion", guerry).fit()
@pytest.fixture(scope="session")
def impartiality_model():
return smf.logit(
"impartial ~ equal * democracy + continent", data=impartiality_df.to_pandas()
).fit()
@pytest.fixture(scope="session")
def penguins_model():
mod = smf.ols(
"body_mass_g ~ flipper_length_mm * species * bill_length_mm + island",
data=penguins.to_pandas(),
).fit()
return mod
@pytest.fixture(scope="session")
def penguins_mod_add():
mod = smf.ols(
"body_mass_g ~ flipper_length_mm * species * bill_length_mm * island",
penguins.to_pandas(),
).fit()
return mod
@pytest.fixture(scope="session")
def penguins_mod_5var():
mod = smf.ols(
"body_mass_g ~ flipper_length_mm * species * bill_length_mm * island * bill_depth_mm",
penguins.to_pandas(),
).fit()
return mod
@pytest.fixture(scope="session")
def mtcars_mod():
mod = smf.ols("mpg ~ hp * wt * disp * cyl * qsec", data=mtcars_df).fit()
return mod