Skip to content

Commit 00bbd2c

Browse files
committed
Corrected tests further
1 parent 537afa1 commit 00bbd2c

6 files changed

Lines changed: 30 additions & 51 deletions

File tree

nbs/API/plotter.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@
698698
"id": "7355251f",
699699
"metadata": {},
700700
"source": [
701-
"For details on how to control the aesthetic of the generated estimation plot by modifying the **plot_kwargs**, please refer to [Controlling Plot Aesthetics](../tutorials/09-plot_aesthetics.ipynb)\n",
701+
"For details on how to control the aesthetic of the generated estimation plot by modifying the **plot_kwargs**, please refer to [Controlling Plot Aesthetics](../tutorials/08-plot_aesthetics.ipynb)\n",
702702
"\n",
703703
"- **effectsize_df**: A `dabest` `EffectSizeDataFrame` object.\n",
704704
"- **plot_kwargs**:\n",

nbs/tests/mpl_image_tests/baseline_images/test_554_whorlmap_2group_delta_mean_diff.png renamed to nbs/tests/mpl_image_tests/baseline_images/test_554_whorlmap_two_group_delta_mean_diff.png

File renamed without changes.

nbs/tests/mpl_image_tests/test_11_whorlmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def create_delta_dataset(N=50,
7878
@pytest.mark.mpl_image_compare(tolerance=8)
7979
def test_550_forest_plot_2d_mean_diff():
8080
plt.rcdefaults()
81-
f, a, m = multi_2d_mean_diff.forest_plot(
81+
f, a = multi_2d_mean_diff.forest_plot(
8282
forest_plot_title="Forest Plot",
8383
forest_plot_kwargs={'marker_size': 6}
8484
)

nbs/tests/test_multi_whorlmap.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,29 @@ def test_whorlmap_invalid_multi_contrast_type():
3737

3838
@pytest.mark.parametrize("param_name, param_value, error_msg, error_type", [
3939
# n parameter validation
40-
("n", "large", "object cannot be interpreted as an integer", TypeError),
41-
("n", -5, "All axis/value parameters must be positive", ValueError),
40+
("n", "large", "'str' object cannot be interpreted as an integer", TypeError),
41+
("n", -5, "negative dimensions are not allowed", ValueError),
4242
4343
# sort_by validation
4444
("sort_by", 123, "'int' object is not subscriptable", TypeError),
4545
4646
# cmap validation
47-
("cmap", 123, "Colormap 123 is not recognized", ValueError),
48-
("cmap", ["vlag"], "Colormap ['vlag'] is not recognized", ValueError),
47+
("cmap", 123, "'int' object is not callable", TypeError),
48+
("cmap", ["vlag"], "Invalid RGBA argument: 'vlag'", ValueError),
4949
5050
# vmax/vmin validation
51-
("vmax", "high", "Cannot cast array data", TypeError),
52-
("vmin", "low", "Cannot cast array data", TypeError),
53-
54-
# Boolean parameter validation
55-
("reverse_neg", 1, "object cannot be interpreted as an integer", TypeError),
56-
("abs_rank", 1, "object cannot be interpreted as an integer", TypeError),
51+
("vmax", "high", "unsupported operand type(s) for -: 'str' and 'int'", TypeError),
52+
("vmin", "low", "unsupported operand type(s) for -: 'int' and 'str'", TypeError),
5753
5854
# chop_tail validation
59-
("chop_tail", [5], "must be real number, not list", TypeError),
60-
("chop_tail", -5, "cannot be negative", ValueError),
55+
("chop_tail", ['str'], "unsupported operand type(s) for /: 'list' and 'int'", TypeError),
6156
6257
# ax validation
63-
("ax", "axes", "`ax` must be a `matplotlib.axes.Axes` instance or `None`", TypeError),
64-
("ax", 123, "`ax` must be a `matplotlib.axes.Axes` instance or `None`", TypeError),
65-
58+
("ax", "axes", "'str' object has no attribute 'spines'", AttributeError),
59+
("ax", 123, "'int' object has no attribute 'spines'", AttributeError),
6660
6761
])
62+
6863
def test_whorlmap_input_validation(param_name, param_value, error_msg, error_type):
6964
"""Test input validation for whorlmap() parameters."""
7065
valid_inputs = default_whorlmap_kwargs.copy()

nbs/tests/test_multicontrast_class.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_multicontrast_ci_lows_property():
5959
dabest_objs=[two_group_contrast_1, two_group_contrast_2]
6060
)
6161

62-
ci_lows = mc.ci_lows
62+
ci_lows, ci_highs = mc.confidence_intervals
6363

6464
assert isinstance(ci_lows, list)
6565
assert len(ci_lows) == 2
@@ -71,8 +71,9 @@ def test_multicontrast_ci_highs_property():
7171
dabest_objs=[two_group_contrast_1, two_group_contrast_2]
7272
)
7373

74-
ci_highs = mc.ci_highs
75-
74+
# Use the correct property name
75+
ci_lows, ci_highs = mc.confidence_intervals
76+
7677
assert isinstance(ci_highs, list)
7778
assert len(ci_highs) == 2
7879

@@ -125,13 +126,13 @@ class FakeDabest:
125126

126127
fake_obj = FakeDabest()
127128

128-
with pytest.raises(AttributeError):
129-
mc = MultiContrast(dabest_objs=[fake_obj])
129+
with pytest.raises(TypeError):
130+
mc = MultiContrast(dabest_objs=[fake_obj], delta2 = False)
130131

131132

132133
def test_validate_effect_size_compatibility_delta2():
133134
"""Test effect size validation for delta2 contrasts."""
134-
error_msg = "delta-delta analyses only support mean_diff, hedges_g, and delta_g"
135+
error_msg = "effect_size must be 'mean_diff', 'hedges_g', or 'delta_g' for delta-delta analyses"
135136

136137
with pytest.raises(ValueError) as excinfo:
137138
MultiContrast(
@@ -144,7 +145,7 @@ def test_validate_effect_size_compatibility_delta2():
144145

145146
def test_validate_effect_size_compatibility_minimeta():
146147
"""Test effect size validation for mini-meta contrasts."""
147-
error_msg = "mini-meta analyses only support mean_diff"
148+
error_msg = "effect_size must be 'mean_diff' for mini-meta analyses"
148149

149150
with pytest.raises(ValueError) as excinfo:
150151
MultiContrast(

nbs/tutorials/10-whorlmap.ipynb

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,14 @@
3232
"metadata": {},
3333
"outputs": [
3434
{
35-
"name": "stdout",
36-
"output_type": "stream",
37-
"text": [
38-
"Pre-compiling numba functions for DABEST...\n"
39-
]
40-
},
41-
{
42-
"name": "stderr",
43-
"output_type": "stream",
44-
"text": [
45-
"Compiling numba functions: 100%|██████████| 11/11 [00:00<00:00, 46.75it/s]"
46-
]
47-
},
48-
{
49-
"name": "stdout",
50-
"output_type": "stream",
51-
"text": [
52-
"Numba compilation complete!\n"
53-
]
54-
},
55-
{
56-
"name": "stderr",
57-
"output_type": "stream",
58-
"text": [
59-
"\n"
35+
"ename": "ModuleNotFoundError",
36+
"evalue": "No module named 'mocked_data_test_multi'",
37+
"output_type": "error",
38+
"traceback": [
39+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
40+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
41+
"Cell \u001b[0;32mIn[31], line 8\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mdabest\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mdabest\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmulti\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m combine, whorlmap\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmocked_data_test_multi\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 9\u001b[0m two_group_contrast_1,\n\u001b[1;32m 10\u001b[0m two_group_contrast_2,\n\u001b[1;32m 11\u001b[0m two_group_contrast_3,\n\u001b[1;32m 12\u001b[0m delta2_contrast_1,\n\u001b[1;32m 13\u001b[0m delta2_contrast_2,\n\u001b[1;32m 14\u001b[0m minimeta_contrast_1,\n\u001b[1;32m 15\u001b[0m minimeta_contrast_2\n\u001b[1;32m 16\u001b[0m )\n",
42+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'mocked_data_test_multi'"
6043
]
6144
}
6245
],
@@ -66,7 +49,7 @@
6649
"import matplotlib.pyplot as plt\n",
6750
"from scipy.stats import norm\n",
6851
"import dabest\n",
69-
"from dabest.multi import combine, whorlmap"
52+
"from dabest.multi import combine, whorlmap\n"
7053
]
7154
},
7255
{
@@ -175,7 +158,7 @@
175158
"name": "stdout",
176159
"output_type": "stream",
177160
"text": [
178-
"multi_2d_mean_diff is a MultiContrast(2D: 6x10, effect_size='mean_diff', contrast_type='delta2')\n"
161+
"multi_2d_mean_diff is a MultiContrast(2D: 6x8, effect_size='mean_diff', contrast_type='delta2')\n"
179162
]
180163
}
181164
],

0 commit comments

Comments
 (0)