diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 369832e9bc05c..141c4224bc6de 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -27,7 +27,6 @@ pa_version_under4p0, ) -PY38 = sys.version_info >= (3, 8) PY39 = sys.version_info >= (3, 9) PY310 = sys.version_info >= (3, 10) PYPY = platform.python_implementation() == "PyPy" diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 7cf319e1d134c..b6c6baf6cc7e4 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -21,7 +21,6 @@ from pandas import ( DataFrame, Series, - compat, date_range, ) import pandas._testing as tm @@ -1283,10 +1282,8 @@ def test_assignment_column(self): msg = "left hand side of an assignment must be a single name" with pytest.raises(SyntaxError, match=msg): df.eval("d,c = a + b") - if compat.PY38: - msg = "cannot assign to function call" - else: - msg = "can't assign to function call" + + msg = "cannot assign to function call" with pytest.raises(SyntaxError, match=msg): df.eval('Timestamp("20131001") = a + b') @@ -1971,9 +1968,7 @@ def test_bool_ops_fails_on_scalars(lhs, cmp, rhs, engine, parser): "other", [ "'x'", - pytest.param( - "...", marks=pytest.mark.xfail(not compat.PY38, reason="GH-28116") - ), + "...", ], ) def test_equals_various(other): diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index 2d418fcbcc395..d97ba8694818b 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -11,7 +11,6 @@ from pandas.compat import ( IS64, - PY38, PY310, is_platform_windows, ) @@ -1715,7 +1714,7 @@ def test_json_multiindex(self, dataframe, expected): assert result == expected @pytest.mark.xfail( - is_platform_windows() and PY38, + is_platform_windows(), reason="localhost connection rejected", strict=False, ) diff --git a/pandas/tests/io/test_parquet.py b/pandas/tests/io/test_parquet.py index d100c584b698a..12a79f68d71c8 100644 --- a/pandas/tests/io/test_parquet.py +++ b/pandas/tests/io/test_parquet.py @@ -13,10 +13,7 @@ from pandas._config import get_option -from pandas.compat import ( - PY38, - is_platform_windows, -) +from pandas.compat import is_platform_windows from pandas.compat.pyarrow import ( pa_version_under1p0, pa_version_under2p0, @@ -651,7 +648,7 @@ def test_categorical(self, pa): check_round_trip(df, pa) @pytest.mark.xfail( - is_platform_windows() and PY38, + is_platform_windows(), reason="localhost connection rejected", strict=False, ) diff --git a/pandas/tests/io/test_pickle.py b/pandas/tests/io/test_pickle.py index 7cf9d7e9a1925..ddd5429e39e44 100644 --- a/pandas/tests/io/test_pickle.py +++ b/pandas/tests/io/test_pickle.py @@ -32,7 +32,6 @@ import pytest from pandas.compat import ( - PY38, get_lzma_file, import_lzma, is_platform_little_endian, @@ -210,7 +209,6 @@ def python_unpickler(path): pytest.param( functools.partial(pd.to_pickle, protocol=5), id="pandas_proto_5", - marks=pytest.mark.skipif(not PY38, reason="protocol 5 not supported"), ), ], ) diff --git a/pandas/tests/io/xml/test_to_xml.py b/pandas/tests/io/xml/test_to_xml.py index 1e2973075f98e..478f4c803479d 100644 --- a/pandas/tests/io/xml/test_to_xml.py +++ b/pandas/tests/io/xml/test_to_xml.py @@ -9,7 +9,6 @@ import numpy as np import pytest -from pandas.compat import PY38 import pandas.util._test_decorators as td from pandas import DataFrame @@ -364,10 +363,6 @@ def test_na_empty_elem_option(datapath, parser): # ATTR_COLS -@pytest.mark.skipif( - not PY38, - reason=("etree alpha ordered attributes < py 3.8"), -) def test_attrs_cols_nan_output(datapath, parser): expected = """\ @@ -383,10 +378,6 @@ def test_attrs_cols_nan_output(datapath, parser): assert output == expected -@pytest.mark.skipif( - not PY38, - reason=("etree alpha ordered attributes < py3.8"), -) def test_attrs_cols_prefix(datapath, parser): expected = """\ @@ -541,10 +532,6 @@ def test_hierarchical_columns(datapath, parser): assert output == expected -@pytest.mark.skipif( - not PY38, - reason=("etree alpha ordered attributes < py3.8"), -) def test_hierarchical_attrs_columns(datapath, parser): expected = """\ @@ -614,10 +601,6 @@ def test_multi_index(datapath, parser): assert output == expected -@pytest.mark.skipif( - not PY38, - reason=("etree alpha ordered attributes < py3.8"), -) def test_multi_index_attrs_cols(datapath, parser): expected = """\ diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index 823d155360908..d84ef65d4c691 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -10,7 +10,6 @@ import numpy as np import pytest -from pandas.compat import PY38 import pandas.util._test_decorators as td from pandas import DataFrame @@ -255,10 +254,6 @@ def test_parser_consistency_file(datapath): @tm.network @pytest.mark.slow @td.skip_if_no("lxml") -@pytest.mark.skipif( - not PY38, - reason=("etree alpha ordered attributes < py3.8"), -) def test_parser_consistency_url(datapath): url = ( "https://data.cityofchicago.org/api/views/" diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 1f935a5debde1..21ed57813b60d 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -9,7 +9,6 @@ import pytz from pandas._libs.tslibs import iNaT -import pandas.compat as compat from pandas.core.dtypes.common import is_datetime64_any_dtype @@ -138,13 +137,7 @@ def test_round_nat(klass, method, freq): "dst", "fromordinal", "fromtimestamp", - pytest.param( - "fromisocalendar", - marks=pytest.mark.skipif( - not compat.PY38, - reason="'fromisocalendar' was added in stdlib datetime in python 3.8", - ), - ), + "fromisocalendar", "isocalendar", "strftime", "strptime", @@ -315,11 +308,6 @@ def test_overlap_public_nat_methods(klass, expected): # NaT should have *most* of the Timestamp and Timedelta methods. # In case when Timestamp, Timedelta, and NaT are overlap, the overlap # is considered to be with Timestamp and NaT, not Timedelta. - - # "fromisocalendar" was introduced in 3.8 - if klass is Timestamp and not compat.PY38: - expected.remove("fromisocalendar") - assert _get_overlap_public_nat_methods(klass) == expected diff --git a/pandas/tests/scalar/timestamp/test_constructors.py b/pandas/tests/scalar/timestamp/test_constructors.py index 16ce51a88340e..c6c475f5b87a2 100644 --- a/pandas/tests/scalar/timestamp/test_constructors.py +++ b/pandas/tests/scalar/timestamp/test_constructors.py @@ -17,7 +17,6 @@ Period, Timedelta, Timestamp, - compat, ) import pandas._testing as tm @@ -569,10 +568,6 @@ class SubDatetime(datetime): expected = Timestamp(2000, 1, 1) assert result == expected - @pytest.mark.skipif( - not compat.PY38, - reason="datetime.fromisocalendar was added in Python version 3.8", - ) def test_constructor_fromisocalendar(self): # GH 30395 expected_timestamp = Timestamp("2000-01-03 00:00:00")