Skip to content

CLN: Made final changes to /pandas/tests/scalar #36388

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

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions pandas/tests/scalar/test_na_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def test_comparison_ops():
np.int_(0),
np.float_(0),
np.int_(-0),
np.float_(-0),
],
np.float_(-0)
]
)
@pytest.mark.parametrize("asarray", [True, False])
def test_pow_special(value, asarray):
Expand Down
16 changes: 8 additions & 8 deletions pandas/tests/scalar/timestamp/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def test_addition_subtraction_types(self):
("H", timedelta(hours=1), np.timedelta64(1, "h")),
("D", timedelta(days=1), np.timedelta64(1, "D")),
("W", timedelta(weeks=1), np.timedelta64(1, "W")),
("M", None, np.timedelta64(1, "M")),
],
("M", None, np.timedelta64(1, "M"))
]
)
def test_addition_subtraction_preserve_frequency(self, freq, td, td64):
ts = Timestamp("2014-03-05 00:00:00", freq=freq)
Expand Down Expand Up @@ -174,8 +174,8 @@ def test_radd_tdscalar(self, td):
(np.timedelta64(-123, "ns"), -123),
(np.timedelta64(1234567898, "ns"), 1234567898),
(np.timedelta64(-123, "us"), -123000),
(np.timedelta64(-123, "ms"), -123000000),
],
(np.timedelta64(-123, "ms"), -123000000)
]
)
def test_timestamp_add_timedelta64_unit(self, other, expected_difference):
ts = Timestamp(datetime.utcnow())
Expand All @@ -187,17 +187,17 @@ def test_timestamp_add_timedelta64_unit(self, other, expected_difference):
"ts",
[
Timestamp("1776-07-04", freq="D"),
Timestamp("1776-07-04", tz="UTC", freq="D"),
],
Timestamp("1776-07-04", tz="UTC", freq="D")
]
)
@pytest.mark.parametrize(
"other",
[
1,
np.int64(1),
np.array([1, 2], dtype=np.int32),
np.array([3, 4], dtype=np.uint64),
],
np.array([3, 4], dtype=np.uint64)
]
)
def test_add_int_with_freq(self, ts, other):
msg = "Addition/subtraction of integers and integer-arrays"
Expand Down
32 changes: 16 additions & 16 deletions pandas/tests/scalar/timestamp/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ def test_constructor(self):
(
"2014-07-01 10:00",
datetime(2014, 7, 1, 10),
base_expected + 3600 * 1_000_000_000,
base_expected + 3600 * 1_000_000_000
),
(
"2014-07-01 09:00:00.000008000",
datetime(2014, 7, 1, 9, 0, 0, 8),
base_expected + 8000,
base_expected + 8000
),
(
"2014-07-01 09:00:00.000000005",
Timestamp("2014-07-01 09:00:00.000000005"),
base_expected + 5,
),
base_expected + 5
)
]

timezones = [
Expand All @@ -50,7 +50,7 @@ def test_constructor(self):
("US/Eastern", -4),
("dateutil/US/Pacific", -7),
(pytz.FixedOffset(-180), -3),
(dateutil.tz.tzoffset(None, 18000), 5),
(dateutil.tz.tzoffset(None, 18000), 5)
]

for date_str, date, expected in tests:
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_constructor_with_stringoffset(self):
(base_str, base_expected),
("2014-07-01 12:00:00+02:00", base_expected + 3600 * 1_000_000_000),
("2014-07-01 11:00:00.000008000+02:00", base_expected + 8000),
("2014-07-01 11:00:00.000000005+02:00", base_expected + 5),
("2014-07-01 11:00:00.000000005+02:00", base_expected + 5)
]

timezones = [
Expand All @@ -104,7 +104,7 @@ def test_constructor_with_stringoffset(self):
("US/Eastern", -4),
("dateutil/US/Pacific", -7),
(pytz.FixedOffset(-180), -3),
(dateutil.tz.tzoffset(None, 18000), 5),
(dateutil.tz.tzoffset(None, 18000), 5)
]

for date_str, expected in tests:
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_constructor_tz_or_tzinfo(self):
Timestamp(year=2017, month=10, day=22, tz=pytz.utc),
Timestamp(datetime(2017, 10, 22), tzinfo=pytz.utc),
Timestamp(datetime(2017, 10, 22), tz="UTC"),
Timestamp(datetime(2017, 10, 22), tz=pytz.utc),
Timestamp(datetime(2017, 10, 22), tz=pytz.utc)
]
assert all(ts == stamps[0] for ts in stamps)

Expand Down Expand Up @@ -267,7 +267,7 @@ def test_constructor_keyword(self):
hour=1,
minute=2,
second=3,
microsecond=999999,
microsecond=999999
)
) == repr(Timestamp("2015-11-12 01:02:03.999999"))

Expand Down Expand Up @@ -306,7 +306,7 @@ def test_constructor_fromordinal(self):
minute=4,
second=5,
microsecond=6,
nanosecond=1,
nanosecond=1
),
Timestamp(
year=2000,
Expand All @@ -317,11 +317,11 @@ def test_constructor_fromordinal(self):
second=5,
microsecond=6,
nanosecond=1,
tz="UTC",
tz="UTC"
),
Timestamp(2000, 1, 2, 3, 4, 5, 6, 1, None),
Timestamp(2000, 1, 2, 3, 4, 5, 6, 1, pytz.UTC),
],
Timestamp(2000, 1, 2, 3, 4, 5, 6, 1, pytz.UTC)
]
)
def test_constructor_nanosecond(self, result):
# GH 18898
Expand All @@ -346,8 +346,8 @@ def test_constructor_invalid_Z0_isostring(self, z):
"minute",
"second",
"microsecond",
"nanosecond",
],
"nanosecond"
]
)
def test_invalid_date_kwarg_with_string_input(self, arg):
kwarg = {arg: 1}
Expand Down Expand Up @@ -538,7 +538,7 @@ class SubDatetime(datetime):

@pytest.mark.skipif(
not compat.PY38,
reason="datetime.fromisocalendar was added in Python version 3.8",
reason="datetime.fromisocalendar was added in Python version 3.8"
)
def test_constructor_fromisocalendar(self):
# GH 30395
Expand Down