@@ -21,12 +21,25 @@ def fitted_estimator(dataset):
21
21
return est .fit_dataset (dataset )
22
22
23
23
24
+ @pytest .fixture
25
+ def small_variance_estimator (small_variance_dataset ):
26
+ """Create a fitted Estimator with small variances as a fixture."""
27
+ est = DerSimonianLaird ()
28
+ return est .fit_dataset (small_variance_dataset )
29
+
30
+
24
31
@pytest .fixture
25
32
def results (fitted_estimator ):
26
33
"""Create a results object as a fixture."""
27
34
return fitted_estimator .summary ()
28
35
29
36
37
+ @pytest .fixture
38
+ def small_variance_results (small_variance_estimator ):
39
+ """Create a results object with small variances as a fixture."""
40
+ return small_variance_estimator .summary ()
41
+
42
+
30
43
@pytest .fixture
31
44
def results_2d (fitted_estimator , dataset_2d ):
32
45
"""Create a 2D results object as a fixture."""
@@ -169,6 +182,15 @@ def test_mrr_to_df(results):
169
182
assert np .allclose (df ["p-value" ].values , [0.9678 , 0.4369 ], atol = 1e-4 )
170
183
171
184
185
+ def test_small_variance_mrr_to_df (small_variance_results ):
186
+ """Test conversion of MetaRegressionResults to DataFrame."""
187
+ df = small_variance_results .to_df ()
188
+ assert df .shape == (2 , 7 )
189
+ col_names = {"estimate" , "p-value" , "z-score" , "ci_0.025" , "ci_0.975" , "se" , "name" }
190
+ assert set (df .columns ) == col_names
191
+ assert np .allclose (df ["p-value" ].values , [1 , np .finfo (np .float64 ).eps ], atol = 1e-4 )
192
+
193
+
172
194
def test_estimator_summary (dataset ):
173
195
"""Test Estimator's summary method."""
174
196
est = WeightedLeastSquares ()
0 commit comments