Skip to content

Commit 9330f43

Browse files
authored
Merge branch 'pyjanitor-devs:dev' into ci/testing-env
2 parents bd99a1a + cdf62da commit 9330f43

12 files changed

+63
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- [ENH] Fix error when `sort_by_appearance=True` is combined with `dropna=True`. Issue #1168 @samukweku
2929
- [ENH] Add explicit default parameter to `case_when` function. Issue #1159 @samukweku
3030
- [BUG] pandas 1.5.x `_MergeOperation` doesn't have `copy` keyword anymore. Issue #1174 @Zeroto521
31+
- [TST] Compat with macos and window, to fix `FailedHealthCheck` Issue #1181 @Zeroto521
3132

3233
## [v0.23.1] - 2022-05-03
3334

tests/functions/test_add_column.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pandas as pd
33
import pytest
44
from hypothesis import given
5+
from hypothesis import settings
56
from hypothesis import strategies as st
67
from pandas.testing import assert_series_equal
78

@@ -10,6 +11,7 @@
1011

1112
@pytest.mark.functions
1213
@given(df=df_strategy())
14+
@settings(deadline=None)
1315
def test_add_column_add_integer(df):
1416
"""col_name wasn't a string"""
1517
with pytest.raises(TypeError):
@@ -48,6 +50,7 @@ def test_add_column_too_few_but_no_fill_remaining(dataframe):
4850

4951
@pytest.mark.functions
5052
@given(df=df_strategy())
53+
@settings(deadline=None)
5154
def test_add_column_scalar(df):
5255
"""Checks `add_column` works as expected when adding a numeric scalar
5356
to the column"""
@@ -63,6 +66,7 @@ def test_add_column_scalar(df):
6366

6467
@pytest.mark.functions
6568
@given(df=df_strategy())
69+
@settings(deadline=None)
6670
def test_add_column_string(df):
6771
"""Checks `add_column` works as expected when adding a string scalar
6872
to the column.
@@ -94,6 +98,7 @@ def test_add_column_iterator_repeat_subtraction(dataframe):
9498

9599
@pytest.mark.functions
96100
@given(df=df_strategy())
101+
@settings(deadline=None)
97102
def test_add_column_fill_scalar(df):
98103
"""Checks the `fill_remaining` parameter works as expected when value
99104
is a scalar."""
@@ -105,6 +110,7 @@ def test_add_column_fill_scalar(df):
105110

106111
@pytest.mark.functions
107112
@given(df=df_strategy(), vals=st.lists(elements=st.integers()))
113+
@settings(deadline=None)
108114
def test_add_column_fill_remaining_iterable(df, vals: list):
109115
"""Checks the `fill_remaining` parameter works as expected."""
110116
if len(vals) > len(df) or not vals:

tests/functions/test_add_columns.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pandas as pd
33
import pytest
44
from hypothesis import given
5+
from hypothesis import settings
56
from hypothesis import strategies as st
67
from pandas.testing import assert_series_equal
78

@@ -14,6 +15,7 @@
1415
x_vals=st.floats(),
1516
n_yvals=st.integers(min_value=0, max_value=100),
1617
)
18+
@settings(deadline=None)
1719
def test_add_columns(df, x_vals, n_yvals):
1820
"""
1921
Test for adding multiple columns at the same time.

tests/functions/test_bin_numeric.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import pytest
22
from hypothesis import given
3+
from hypothesis import settings
34

45
from janitor.testing_utils.strategies import df_strategy
56

67

78
@pytest.mark.functions
89
@given(df=df_strategy())
10+
@settings(deadline=None)
911
def test_bin_numeric_expected_columns(df):
10-
1112
df = df.bin_numeric(from_column_name="a", to_column_name="a_bin")
1213
expected_columns = [
1314
"a",
@@ -23,6 +24,7 @@ def test_bin_numeric_expected_columns(df):
2324

2425
@pytest.mark.functions
2526
@given(df=df_strategy())
27+
@settings(deadline=None)
2628
def test_bin_numeric_kwargs_has_no_retbins(df):
2729

2830
with pytest.raises(ValueError):

tests/functions/test_case_when.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pandas as pd
33
import pytest
4+
from hypothesis import settings
45
from hypothesis import given
56
from pandas.testing import assert_frame_equal
67

@@ -128,6 +129,7 @@ def test_error_multiple_conditions():
128129

129130

130131
@given(df=df_strategy())
132+
@settings(deadline=None)
131133
def test_case_when_condition_callable(df):
132134
"""Test case_when for callable."""
133135
result = df.case_when(
@@ -139,6 +141,7 @@ def test_case_when_condition_callable(df):
139141

140142

141143
@given(df=df_strategy())
144+
@settings(deadline=None)
142145
def test_case_when_condition_eval(df):
143146
"""Test case_when for callable."""
144147
result = df.case_when("a < 10", "baby", default="bleh", column_name="bleh")
@@ -148,6 +151,7 @@ def test_case_when_condition_eval(df):
148151

149152

150153
@given(df=df_strategy())
154+
@settings(deadline=None)
151155
def test_case_when_replacement_callable(df):
152156
"""Test case_when for callable."""
153157
result = df.case_when(
@@ -214,6 +218,7 @@ def test_case_when_default_index(df):
214218

215219

216220
@given(df=df_strategy())
221+
@settings(deadline=None)
217222
def test_case_when_multiple_args(df):
218223
"""Test case_when for multiple arguments."""
219224
result = df.case_when(

tests/functions/test_complete.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
from string import ascii_lowercase
2+
13
import numpy as np
24
import pandas as pd
35
import pytest
46
from hypothesis import given
7+
from hypothesis import settings
58
from pandas.testing import assert_frame_equal
6-
from janitor.testing_utils.strategies import (
7-
categoricaldf_strategy,
8-
)
9-
from string import ascii_lowercase
9+
10+
from janitor.testing_utils.strategies import categoricaldf_strategy
1011

1112

1213
@pytest.fixture
@@ -156,6 +157,7 @@ def test_type_explicit(fill_df):
156157

157158

158159
@given(df=categoricaldf_strategy())
160+
@settings(deadline=None)
159161
def test_all_strings_no_nulls(df):
160162
"""
161163
Test `complete` output when *columns
@@ -177,6 +179,7 @@ def test_all_strings_no_nulls(df):
177179

178180

179181
@given(df=categoricaldf_strategy())
182+
@settings(deadline=None)
180183
def test_dict(df):
181184
"""
182185
Test `complete` output when *columns
@@ -228,6 +231,7 @@ def test_dict_extension_array(df):
228231

229232

230233
@given(df=categoricaldf_strategy())
234+
@settings(deadline=None)
231235
def test_dict_numpy(df):
232236
"""
233237
Test `complete` output when *columns
@@ -254,6 +258,7 @@ def test_dict_numpy(df):
254258

255259

256260
@given(df=categoricaldf_strategy())
261+
@settings(deadline=None)
257262
def test_dict_Index(df):
258263
"""
259264
Test `complete` output when *columns
@@ -282,6 +287,7 @@ def test_dict_Index(df):
282287

283288

284289
@given(df=categoricaldf_strategy())
290+
@settings(deadline=None)
285291
def test_dict_duplicated(df):
286292
"""
287293
Test `complete` output when *columns

tests/functions/test_encode_categorical.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import pytest
55
from hypothesis import given
6+
from hypothesis import settings
67
from pandas.testing import assert_frame_equal
78

89
from janitor.testing_utils.strategies import (
@@ -32,6 +33,7 @@ def test_encode_categorical(df):
3233

3334
@pytest.mark.functions
3435
@given(df=df_strategy())
36+
@settings(deadline=None)
3537
def test_encode_categorical_missing_column(df):
3638
"""
3739
Raise ValueError for missing columns
@@ -44,6 +46,7 @@ def test_encode_categorical_missing_column(df):
4446

4547
@pytest.mark.functions
4648
@given(df=df_strategy())
49+
@settings(deadline=None)
4750
def test_encode_categorical_missing_columns(df):
4851
"""
4952
Raise ValueError for missing columns
@@ -56,6 +59,7 @@ def test_encode_categorical_missing_columns(df):
5659

5760
@pytest.mark.functions
5861
@given(df=df_strategy())
62+
@settings(deadline=None)
5963
def test_encode_categorical_invalid_input(df):
6064
"""
6165
Raise ValueError for wrong input type
@@ -67,6 +71,7 @@ def test_encode_categorical_invalid_input(df):
6771

6872
@pytest.mark.functions
6973
@given(df=df_strategy())
74+
@settings(deadline=None)
7075
def test_encode_categorical_invalid_input_2(df):
7176
"""
7277
Raise TypeError for wrong input type
@@ -78,6 +83,7 @@ def test_encode_categorical_invalid_input_2(df):
7883

7984
@pytest.mark.functions
8085
@given(df=df_strategy())
86+
@settings(deadline=None)
8187
def test_encode_categorical_multiple_column_names(df):
8288
"""
8389
Test output when more than one column is provided
@@ -147,6 +153,7 @@ def test_categories_ndim_DataFrame_gt_1_in_kwargs(df_checks):
147153

148154
@pytest.mark.functions
149155
@given(df=df_strategy())
156+
@settings(deadline=None)
150157
def test_categories_null_in_categories(df):
151158
"""
152159
Raise ValueError if categories is provided, but has nulls.
@@ -157,6 +164,7 @@ def test_categories_null_in_categories(df):
157164

158165
@pytest.mark.functions
159166
@given(df=df_strategy())
167+
@settings(deadline=None)
160168
def test_non_unique_cat(df):
161169
"""Raise ValueError if categories is provided, but is not unique."""
162170
with pytest.raises(ValueError):
@@ -165,6 +173,7 @@ def test_non_unique_cat(df):
165173

166174
@pytest.mark.functions
167175
@given(df=df_strategy())
176+
@settings(deadline=None)
168177
def test_empty_cat(df):
169178
"""Raise ValueError if empty categories is provided."""
170179
with pytest.raises(ValueError):
@@ -173,6 +182,7 @@ def test_empty_cat(df):
173182

174183
@pytest.mark.functions
175184
@given(df=df_strategy())
185+
@settings(deadline=None)
176186
def test_empty_col(df):
177187
"""
178188
Raise ValueError if categories is provided,
@@ -199,6 +209,7 @@ def test_warnings(df):
199209

200210
@pytest.mark.functions
201211
@given(df=df_strategy())
212+
@settings(deadline=None)
202213
def test_order_wrong_option_in_kwargs(df):
203214
"""
204215
Raise ValueError if a string is provided, but is not
@@ -210,6 +221,7 @@ def test_order_wrong_option_in_kwargs(df):
210221

211222
@pytest.mark.functions
212223
@given(df=df_strategy())
224+
@settings(deadline=None)
213225
def test_empty_col_sort(df):
214226
"""
215227
Raise ValueError if a string is provided,
@@ -285,6 +297,7 @@ def test_all_cat_None_2(df):
285297

286298
@pytest.mark.functions
287299
@given(df=categoricaldf_strategy())
300+
@settings(deadline=None)
288301
def test_all_cat_not_None(df):
289302
"""
290303
Test output where categories is provided.

tests/functions/test_expand_grid.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
from functools import reduce
2+
13
import numpy as np
24
import pandas as pd
35
import pytest
4-
from hypothesis import given, settings
6+
from hypothesis import given
7+
from hypothesis import settings
58
from pandas.testing import assert_frame_equal
6-
from janitor.testing_utils.strategies import (
7-
df_strategy,
8-
categoricaldf_strategy,
9-
)
9+
1010
from janitor.functions import expand_grid
11-
from functools import reduce
11+
from janitor.testing_utils.strategies import df_strategy
12+
from janitor.testing_utils.strategies import categoricaldf_strategy
1213

1314

1415
@given(df=df_strategy())
@@ -19,6 +20,7 @@ def test_others_not_dict(df):
1920

2021

2122
@given(df=df_strategy())
23+
@settings(deadline=None)
2224
def test_others_none(df):
2325
"""Return DataFrame if no `others`, and df exists."""
2426
assert_frame_equal(df.expand_grid("df"), df)
@@ -37,6 +39,7 @@ def test_df_key(df):
3739

3840

3941
@given(df=df_strategy())
42+
@settings(deadline=None)
4043
def test_df_key_hashable(df):
4144
"""Raise error if df exists and df_key is not Hashable."""
4245
with pytest.raises(TypeError):

tests/functions/test_filter_column_isin.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import pytest
2-
from hypothesis import assume, given
2+
from hypothesis import assume
3+
from hypothesis import given
4+
from hypothesis import settings
35

4-
from janitor.testing_utils.strategies import (
5-
categoricaldf_strategy,
6-
names_strategy,
7-
)
6+
from janitor.testing_utils.strategies import categoricaldf_strategy
7+
from janitor.testing_utils.strategies import names_strategy
88

99

1010
@pytest.mark.functions
1111
@given(df=categoricaldf_strategy(), iterable=names_strategy())
12+
@settings(deadline=None)
1213
def test_filter_column_isin(df, iterable):
1314
"""
1415
`filter_column_isin` should return the property that the column of

tests/functions/test_remove_empty.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import pandas as pd
33
import pytest
44
from hypothesis import given
5+
from hypothesis import settings
56

67
from janitor.testing_utils.strategies import df_strategy
78

89

910
@pytest.mark.functions
1011
@given(df=df_strategy())
12+
@settings(deadline=None)
1113
def test_remove_empty(df):
1214
# This test ensures that there are no columns that are completely null.
1315
df = df.remove_empty()

0 commit comments

Comments
 (0)