diff --git a/pandas/tests/scalar/period/test_period.py b/pandas/tests/scalar/period/test_period.py index 3bdf91cbf838b..73371c48f9370 100644 --- a/pandas/tests/scalar/period/test_period.py +++ b/pandas/tests/scalar/period/test_period.py @@ -1044,6 +1044,7 @@ def test_add_sub_nat(self): assert NaT - p is NaT p = Period("NaT", freq="M") + assert p is NaT assert p + NaT is NaT assert NaT + p is NaT assert p - NaT is NaT @@ -1284,6 +1285,7 @@ def test_add_offset_nat(self): # freq is DateOffset for freq in ["A", "2A", "3A"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [offsets.YearEnd(2)]: assert p + o is NaT assert o + p is NaT @@ -1300,6 +1302,7 @@ def test_add_offset_nat(self): for freq in ["M", "2M", "3M"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [offsets.MonthEnd(2), offsets.MonthEnd(12)]: assert p + o is NaT assert o + p is NaT @@ -1317,6 +1320,7 @@ def test_add_offset_nat(self): # freq is Tick for freq in ["D", "2D", "3D"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [ offsets.Day(5), offsets.Hour(24), @@ -1340,6 +1344,7 @@ def test_add_offset_nat(self): for freq in ["H", "2H", "3H"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [ offsets.Day(2), offsets.Hour(3), @@ -1439,6 +1444,7 @@ def test_sub_offset_nat(self): # freq is DateOffset for freq in ["A", "2A", "3A"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [offsets.YearEnd(2)]: assert p - o is NaT @@ -1453,6 +1459,7 @@ def test_sub_offset_nat(self): for freq in ["M", "2M", "3M"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [offsets.MonthEnd(2), offsets.MonthEnd(12)]: assert p - o is NaT @@ -1468,6 +1475,7 @@ def test_sub_offset_nat(self): # freq is Tick for freq in ["D", "2D", "3D"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [ offsets.Day(5), offsets.Hour(24), @@ -1489,6 +1497,7 @@ def test_sub_offset_nat(self): for freq in ["H", "2H", "3H"]: p = Period("NaT", freq=freq) + assert p is NaT for o in [ offsets.Day(2), offsets.Hour(3), @@ -1511,6 +1520,7 @@ def test_sub_offset_nat(self): @pytest.mark.parametrize("freq", ["M", "2M", "3M"]) def test_nat_ops(self, freq): p = Period("NaT", freq=freq) + assert p is NaT assert p + 1 is NaT assert 1 + p is NaT assert p - 1 is NaT diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index 652dd34ca7ce2..f9fa80644d4b9 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -202,8 +202,6 @@ def test_constructor(self): base_expected = 1404205200000000000 # confirm base representation is correct - import calendar - assert calendar.timegm(base_dt.timetuple()) * 1000000000 == base_expected tests = [ @@ -275,8 +273,6 @@ def test_constructor_with_stringoffset(self): base_expected = 1404205200000000000 # confirm base representation is correct - import calendar - assert calendar.timegm(base_dt.timetuple()) * 1000000000 == base_expected tests = [ diff --git a/pandas/tests/scalar/timestamp/test_timezones.py b/pandas/tests/scalar/timestamp/test_timezones.py index 424b0c9abdef8..250f48b7e711b 100644 --- a/pandas/tests/scalar/timestamp/test_timezones.py +++ b/pandas/tests/scalar/timestamp/test_timezones.py @@ -306,15 +306,14 @@ def test_astimezone(self, tzstr): @td.skip_if_windows def test_tz_convert_utc_with_system_utc(self): - from pandas._libs.tslibs.timezones import maybe_get_tz # from system utc to real utc - ts = Timestamp("2001-01-05 11:56", tz=maybe_get_tz("dateutil/UTC")) + ts = Timestamp("2001-01-05 11:56", tz=timezones.maybe_get_tz("dateutil/UTC")) # check that the time hasn't changed. assert ts == ts.tz_convert(dateutil.tz.tzutc()) # from system utc to real utc - ts = Timestamp("2001-01-05 11:56", tz=maybe_get_tz("dateutil/UTC")) + ts = Timestamp("2001-01-05 11:56", tz=timezones.maybe_get_tz("dateutil/UTC")) # check that the time hasn't changed. assert ts == ts.tz_convert(dateutil.tz.tzutc())