Skip to content

TST: Regression test added for Timedelta #46645

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 5 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
12 changes: 12 additions & 0 deletions pandas/tests/dtypes/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,3 +1107,15 @@ def test_compare_complex_dtypes():

with pytest.raises(TypeError, match=msg):
df.lt(df.astype(object))


def test_categorical_of_booleans_is_boolean():
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unrelated, please merge master

# https://github.com/pandas-dev/pandas/issues/46313
df = pd.DataFrame(
{"int_cat": [1, 2, 3], "bool_cat": [True, False, False]}, dtype="category"
)
value = df["bool_cat"].cat.categories.dtype
expected = np.dtype(np.bool_)
not_expected = np.dtype(np.object_)
assert value is expected
assert value is not not_expected
15 changes: 15 additions & 0 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ def test_constructor_from_2d_datetimearray(self, using_array_manager):
# GH#44724 big performance hit if we de-consolidate
assert len(df._mgr.blocks) == 1

def test_no_overflow_of_freq_and_time_in_dataframe(self):
# GH 35665
# https://github.com/pandas-dev/pandas/issues/35665
df = DataFrame(
{
"string_one": ["2132131SSS"],
"time": [Timedelta("0 days 00:00:00.990000")],
}
)
try:
for _, row in df.iterrows():
row
Copy link
Contributor

Choose a reason for hiding this comment

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

don't put a try/except in a test.

also compare row here

except OverflowError:
assert False, "Regression, see GH 35665"

def test_constructor_dict_with_tzaware_scalar(self):
# GH#42505
dt = Timestamp("2019-11-03 01:00:00-0700").tz_convert("America/Los_Angeles")
Expand Down