diff --git a/pandas/_testing/asserters.py b/pandas/_testing/asserters.py index d0a95e764472d..1bdcb6eda5c42 100644 --- a/pandas/_testing/asserters.py +++ b/pandas/_testing/asserters.py @@ -1244,10 +1244,10 @@ def assert_equal(left, right, **kwargs) -> None: elif isinstance(left, np.ndarray): assert_numpy_array_equal(left, right, **kwargs) elif isinstance(left, str): - assert kwargs == {} + assert not kwargs assert left == right else: - assert kwargs == {} + assert not kwargs assert_almost_equal(left, right) diff --git a/pandas/io/sas/sas7bdat.py b/pandas/io/sas/sas7bdat.py index fd47396347ff9..175e1327ec654 100644 --- a/pandas/io/sas/sas7bdat.py +++ b/pandas/io/sas/sas7bdat.py @@ -384,9 +384,7 @@ def _process_page_meta(self) -> bool: is_data_page = self._current_page_type == const.page_data_type is_mix_page = self._current_page_type == const.page_mix_type return bool( - is_data_page - or is_mix_page - or self._current_page_data_subheader_pointers != [] + is_data_page or is_mix_page or self._current_page_data_subheader_pointers ) def _read_page_header(self) -> None: diff --git a/pandas/io/xml.py b/pandas/io/xml.py index c44972e9b1a4a..1a3d07e25b0ce 100644 --- a/pandas/io/xml.py +++ b/pandas/io/xml.py @@ -373,7 +373,7 @@ def _iterparse_nodes(self, iterparse: Callable) -> list[dict[str, str | None]]: ): del elem.getparent()[0] - if dicts == []: + if not dicts: raise ParserError("No result from selected items in iterparse.") keys = list(dict.fromkeys([k for d in dicts for k in d.keys()])) diff --git a/pandas/tests/apply/test_frame_apply.py b/pandas/tests/apply/test_frame_apply.py index 28c776d0a6d35..aba9ee507e86e 100644 --- a/pandas/tests/apply/test_frame_apply.py +++ b/pandas/tests/apply/test_frame_apply.py @@ -125,7 +125,7 @@ def test_apply_with_reduce_empty(): tm.assert_series_equal(result, expected) # Ensure that x.append hasn't been called - assert x == [] + assert not x @pytest.mark.parametrize("func", ["sum", "prod", "any", "all"]) diff --git a/pandas/tests/frame/test_api.py b/pandas/tests/frame/test_api.py index 1ab20c282b23a..abe8ab06212f2 100644 --- a/pandas/tests/frame/test_api.py +++ b/pandas/tests/frame/test_api.py @@ -315,7 +315,7 @@ async def test_tab_complete_warning(self, ip, frame_or_series): def test_attrs(self): df = DataFrame({"A": [2, 3]}) - assert df.attrs == {} + assert not df.attrs df.attrs["version"] = 1 result = df.rename(columns=str) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 3add6e1482687..272115eabf8a9 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -104,7 +104,7 @@ def test_iter_empty(setup_path): with ensure_clean_store(setup_path) as store: # GH 12221 - assert list(store) == [] + assert not list(store) def test_repr(setup_path): diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index 368e9d5f6e6a1..92696bfdd86c3 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -601,7 +601,7 @@ def test_value_labels_old_format(self, datapath): # predates supporting value labels. dpath = datapath("io", "data", "stata", "S4_EDUC1.dta") with StataReader(dpath) as reader: - assert reader.value_labels() == {} + assert not reader.value_labels() def test_date_export_formats(self): columns = ["tc", "td", "tw", "tm", "tq", "th", "ty"] diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index 4be0aa15523fb..208b97a63c620 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -162,7 +162,7 @@ def test_integer_series_size(self, dtype): def test_attrs(self): s = Series([0, 1], name="abc") - assert s.attrs == {} + assert not s.attrs s.attrs["version"] = 1 result = s + 1 assert result.attrs == {"version": 1} diff --git a/pyproject.toml b/pyproject.toml index 71b1f44dbff6f..16e96c58bf826 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,7 +92,6 @@ disable = [ "unnecessary-dunder-call", "unnecessary-lambda-assignment", "unneeded-not", - "use-implicit-booleaness-not-comparison", "use-implicit-booleaness-not-len", "use-sequence-for-iteration", "useless-import-alias",