Skip to content

TST: Address test warnings #48075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ def _aggregate_frame(self, func, *args, **kwargs) -> DataFrame:
result: dict[Hashable, NDFrame | np.ndarray] = {}
if self.axis == 0:
# test_pass_args_kwargs_duplicate_columns gets here with non-unique columns
for name, data in self:
for name, data in self.grouper.get_iterator(obj, self.axis):
fres = func(data, *args, **kwargs)
result[name] = fres
else:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]:
(
"In a future version of pandas, a length 1 "
"tuple will be returned when iterating over a "
"a groupby with a grouper equal to a list of "
"groupby with a grouper equal to a list of "
"length 1. Don't supply a list with a single grouper "
"to avoid this warning."
),
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/groupby/aggregate/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def func_kwargs(values, index):


@td.skip_if_no("numba")
@pytest.mark.filterwarnings("ignore")
def test_multiindex_one_key(nogil, parallel, nopython):
def numba_func(values, index):
return 1
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,7 @@ def test_single_element_list_grouping():
)
msg = (
"In a future version of pandas, a length 1 "
"tuple will be returned when iterating over a "
"tuple will be returned when iterating over "
"a groupby with a grouper equal to a list of "
"length 1. Don't supply a list with a single grouper "
"to avoid this warning."
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/groupby/transform/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def func_kwargs(values, index):


@td.skip_if_no("numba")
@pytest.mark.filterwarnings("ignore")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just ignore numba-produced warnings?

Copy link
Member Author

@mroeschke mroeschke Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the NumbaPerformanceWarning are safe to ignore. Unfortunately I don't think specifying a "ignore::numba.NumbaPerformanceWarning" can be put in the pyproject.toml because not all builds have numba installed.

def test_multiindex_one_key(nogil, parallel, nopython):
def numba_func(values, index):
return 1
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/io/excel/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def _transfer_marks(engine, read_ext):
for ext in read_ext_params
if _is_valid_engine_ext_pair(eng, ext)
],
ids=str,
)
def engine_and_read_ext(request):
"""
Expand Down Expand Up @@ -654,6 +655,7 @@ def test_read_excel_blank_with_header(self, read_ext):
actual = pd.read_excel("blank_with_header" + read_ext, sheet_name="Sheet1")
tm.assert_frame_equal(actual, expected)

@pytest.mark.filterwarnings("ignore:Cell A4 is marked:UserWarning:openpyxl")
def test_date_conversion_overflow(self, request, engine, read_ext):
# GH 10001 : pandas.ExcelFile ignore parse_dates=False
if engine == "pyxlsb":
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/excel/test_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ def test_to_excel_output_encoding(self, ext):
)

with tm.ensure_clean("__tmp_to_excel_float_format__." + ext) as filename:
df.to_excel(filename, sheet_name="TestSheet", encoding="utf8")
df.to_excel(filename, sheet_name="TestSheet")
result = pd.read_excel(filename, sheet_name="TestSheet", index_col=0)
tm.assert_frame_equal(result, df)

Expand Down Expand Up @@ -1282,6 +1282,7 @@ def test_deprecated_attr(self, engine, ext, attr):
# Some engines raise if nothing is written
DataFrame().to_excel(writer)

@pytest.mark.filterwarnings("ignore:Calling close():UserWarning:xlsxwriter")
@pytest.mark.parametrize(
"attr, args", [("save", ()), ("write_cells", ([], "test"))]
)
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/reshape/merge/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,9 @@ def _check_join(left, right, result, join_col, how="left", lsuffix="_x", rsuffix
left_grouped = left.groupby(join_col)
right_grouped = right.groupby(join_col)

for group_key, group in result.groupby(join_col):
for group_key, group in result.groupby(
join_col if len(join_col) > 1 else join_col[0]
):
l_joined = _restrict_to_columns(group, left.columns, lsuffix)
r_joined = _restrict_to_columns(group, right.columns, rsuffix)

Expand Down