Skip to content

Commit 7a711da

Browse files
committed
fix: return None for tests
1 parent 7d3c152 commit 7a711da

15 files changed

+126
-126
lines changed

tests/indexes/test_indexes.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_index_rename_inplace() -> None:
223223
assert ind2 is None
224224

225225

226-
def test_index_dropna():
226+
def test_index_dropna() -> None:
227227
idx = pd.Index([1, 2])
228228

229229
check(assert_type(idx.dropna(how="all"), "pd.Index[int]"), pd.Index)
@@ -235,7 +235,7 @@ def test_index_dropna():
235235
check(assert_type(midx.dropna(how="any"), pd.MultiIndex), pd.MultiIndex)
236236

237237

238-
def test_index_neg():
238+
def test_index_neg() -> None:
239239
# GH 253
240240
idx = pd.Index([1, 2])
241241
check(assert_type(-idx, "pd.Index[int]"), pd.Index)
@@ -306,7 +306,7 @@ def test_index_relops() -> None:
306306
check(assert_type(ind > 2, np_1darray[np.bool]), np_1darray[np.bool])
307307

308308

309-
def test_range_index_union():
309+
def test_range_index_union() -> None:
310310
check(
311311
assert_type(
312312
pd.RangeIndex(0, 10).union(pd.RangeIndex(10, 20)),
@@ -342,14 +342,14 @@ def test_index_union_sort() -> None:
342342
)
343343

344344

345-
def test_range_index_start_stop_step():
345+
def test_range_index_start_stop_step() -> None:
346346
idx = pd.RangeIndex(3)
347347
check(assert_type(idx.start, int), int)
348348
check(assert_type(idx.stop, int), int)
349349
check(assert_type(idx.step, int), int)
350350

351351

352-
def test_interval_range():
352+
def test_interval_range() -> None:
353353
check(
354354
assert_type(pd.interval_range(0, 10), "pd.IntervalIndex[pd.Interval[int]]"),
355355
pd.IntervalIndex,
@@ -502,7 +502,7 @@ def test_interval_range():
502502
)
503503

504504

505-
def test_interval_index_breaks():
505+
def test_interval_index_breaks() -> None:
506506
check(
507507
assert_type(
508508
pd.IntervalIndex.from_breaks([1, 2, 3, 4]),
@@ -632,7 +632,7 @@ def test_interval_index_breaks():
632632
)
633633

634634

635-
def test_interval_index_arrays():
635+
def test_interval_index_arrays() -> None:
636636
check(
637637
assert_type(
638638
pd.IntervalIndex.from_arrays([1, 2, 3, 4], [2, 3, 4, 5]),
@@ -761,7 +761,7 @@ def test_interval_index_arrays():
761761
)
762762

763763

764-
def test_interval_index_tuples():
764+
def test_interval_index_tuples() -> None:
765765
check(
766766
assert_type(
767767
pd.IntervalIndex.from_tuples([(1, 2), (2, 3)]),
@@ -1082,13 +1082,13 @@ def test_range_index_range() -> None:
10821082
check(assert_type(iri, pd.RangeIndex), pd.RangeIndex, int)
10831083

10841084

1085-
def test_multiindex_dtypes():
1085+
def test_multiindex_dtypes() -> None:
10861086
# GH-597
10871087
mi = pd.MultiIndex.from_tuples([(1, 2.0), (2, 3.0)], names=["foo", "bar"])
10881088
check(assert_type(mi.dtypes, "pd.Series[Dtype]"), pd.Series)
10891089

10901090

1091-
def test_index_constructors():
1091+
def test_index_constructors() -> None:
10921092
# See if we can pick up the different index types in 2.0
10931093
# Eventually should be using a generic index
10941094
ilist = [1, 2, 3]

tests/scalars/test_scalars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def test_interval_math() -> None:
297297
) # pyright: ignore[reportOperatorIssue]
298298

299299

300-
def test_interval_cmp():
300+
def test_interval_cmp() -> None:
301301
interval_i = pd.Interval(0, 1, closed="left")
302302
interval_f = pd.Interval(0.0, 1.0, closed="right")
303303
interval_ts = pd.Interval(

tests/series/test_series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ def test_types_to_dict() -> None:
18191819
assert_type(s.to_dict(), dict[Any, str])
18201820

18211821

1822-
def test_categorical_codes():
1822+
def test_categorical_codes() -> None:
18231823
# GH-111
18241824
cat = pd.Categorical(["a", "b", "a"])
18251825
check(assert_type(cat.codes, np_1darray[np.signedinteger]), np_1darray[np.int8])
@@ -1942,7 +1942,7 @@ def test_squeeze() -> None:
19421942
check(assert_type(s2.squeeze(), "pd.Series[int] | Scalar"), np.integer)
19431943

19441944

1945-
def test_to_xarray():
1945+
def test_to_xarray() -> None:
19461946
s = pd.Series([1, 2])
19471947
check(assert_type(s.to_xarray(), xr.DataArray), xr.DataArray)
19481948

tests/test_api_typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343

4444

45-
def test_dataframegroupby():
45+
def test_dataframegroupby() -> None:
4646
df = pd.DataFrame({"a": [1, 2, 3]})
4747
group = df.groupby("a")
4848

@@ -52,7 +52,7 @@ def f1(gb: DataFrameGroupBy):
5252
f1(group)
5353

5454

55-
def test_seriesgroupby():
55+
def test_seriesgroupby() -> None:
5656
sr = pd.Series([1, 2, 3], index=pd.Index(["a", "b", "a"]))
5757

5858
def f1(gb: SeriesGroupBy):

tests/test_config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Display = Options = Any
2222

2323

24-
def test_option_tools():
24+
def test_option_tools() -> None:
2525
check(assert_type(pd.reset_option("display.width"), None), type(None))
2626
check(assert_type(pd.set_option("display.width", 80), None), type(None))
2727
check(assert_type(pd.describe_option("display.width", False), str), str)
@@ -33,14 +33,14 @@ def test_option_tools():
3333
assert pd.get_option("display.width") == 120
3434

3535

36-
def test_specific_option():
36+
def test_specific_option() -> None:
3737
# GH 294
3838
check(assert_type(pd.options.plotting.backend, str), str)
3939
# Just check assignment
4040
pd.options.plotting.backend = "matplotlib"
4141

4242

43-
def test_display_float_format():
43+
def test_display_float_format() -> None:
4444
check(
4545
assert_type(pd.options.display.float_format, Callable[[float], str] | None),
4646
type(None),
@@ -50,7 +50,7 @@ def test_display_float_format():
5050
assert pd.get_option("display.float_format") == formatter
5151

5252

53-
def test_display_types_none_allowed_get_options():
53+
def test_display_types_none_allowed_get_options() -> None:
5454
# GH 1230
5555
# Initial values
5656
check(assert_type(pd.options.display.chop_threshold, float | None), type(None))
@@ -62,7 +62,7 @@ def test_display_types_none_allowed_get_options():
6262
check(assert_type(pd.options.display.min_rows, int | None), int)
6363

6464

65-
def test_display_types_none_allowed_set_options():
65+
def test_display_types_none_allowed_set_options() -> None:
6666
# GH 1230
6767
# Test setting each option as None and then to a specific value
6868
pd.options.display.chop_threshold = None
@@ -81,7 +81,7 @@ def test_display_types_none_allowed_set_options():
8181
pd.options.display.min_rows = 100
8282

8383

84-
def test_display_types_literal_constraints():
84+
def test_display_types_literal_constraints() -> None:
8585
# GH 1230
8686
# Various display options have specific allowed values
8787
# Test colheader_justify with allowed values

tests/test_frame.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ def test_types_pivot_table() -> None:
15121512
)
15131513

15141514

1515-
def test_pivot_table_sort():
1515+
def test_pivot_table_sort() -> None:
15161516
df = pd.DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6], "d": [7, 8]})
15171517

15181518
check(
@@ -2822,7 +2822,7 @@ def test_dataframe_pct_change() -> None:
28222822
check(assert_type(df.pct_change(fill_value=0), pd.DataFrame), pd.DataFrame)
28232823

28242824

2825-
def test_indexslice_setitem():
2825+
def test_indexslice_setitem() -> None:
28262826
df = pd.DataFrame(
28272827
{"x": [1, 2, 2, 3], "y": [1, 2, 3, 4], "z": [10, 20, 30, 40]}
28282828
).set_index(["x", "y"])
@@ -2833,7 +2833,7 @@ def test_indexslice_setitem():
28332833
df.loc[pd.IndexSlice[pd.Index([2, 3]), :], "z"] = 99
28342834

28352835

2836-
def test_indexslice_getitem():
2836+
def test_indexslice_getitem() -> None:
28372837
# GH 300
28382838
df = (
28392839
pd.DataFrame({"x": [1, 2, 2, 3, 4], "y": [10, 20, 30, 40, 10]})
@@ -2865,7 +2865,7 @@ def test_indexslice_getitem():
28652865
)
28662866

28672867

2868-
def test_compute_values():
2868+
def test_compute_values() -> None:
28692869
df = pd.DataFrame({"x": [1, 2, 3, 4]})
28702870
s: pd.Series = pd.Series([10, 20, 30, 40])
28712871
check(assert_type(df["x"] + s.values, pd.Series), pd.Series, np.int64)
@@ -3295,7 +3295,7 @@ def test_not_hashable() -> None:
32953295
check(assert_type(pd.Index.__hash__, None), type(None))
32963296
check(assert_type(pd.Index([]).__hash__, None), type(None))
32973297

3298-
def test_func(_: Hashable):
3298+
def test_func(_: Hashable) -> None:
32993299
pass
33003300

33013301
if TYPE_CHECKING_INVALID_USAGE:
@@ -3527,7 +3527,7 @@ def test_groupby_result_for_ambiguous_indexes() -> None:
35273527
check(assert_type(value2, pd.DataFrame), pd.DataFrame)
35283528

35293529

3530-
def test_setitem_list():
3530+
def test_setitem_list() -> None:
35313531
# GH 153
35323532
lst1: list[str] = ["a", "b", "c"]
35333533
lst2: list[int] = [1, 2, 3]

tests/test_interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_interval_length() -> None:
121121
_21 = i3 + pd.Timedelta(seconds=20) # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
122122

123123

124-
def test_interval_array_contains():
124+
def test_interval_array_contains() -> None:
125125
df = pd.DataFrame({"A": range(1, 10)})
126126
obj = pd.Interval(1, 4)
127127
ser = pd.Series(obj, index=df.index)

0 commit comments

Comments
 (0)