Skip to content

Commit

Permalink
Update reference in test.
Browse files Browse the repository at this point in the history
Add pandas test.
  • Loading branch information
Flix6x committed Nov 26, 2020
1 parent 2dc3813 commit 2788bd7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions timely_beliefs/tests/test_belief_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ def test_agg_resampling_retains_metadata(resolution):


def test_groupby_retains_metadata():
""" Test whether grouping by index level retains the metadata.
"""Test whether grouping by index level retains the metadata.
Succeeds with pandas==1.0.0
Fails with pandas==1.1.0
Should be fixed with https://github.com/pandas-dev/pandas/pull/35688
Should be fixed with https://github.com/pandas-dev/pandas/pull/37461
"""
df = example_df
metadata = {md: getattr(example_df, md) for md in METADATA}
Expand All @@ -415,3 +415,13 @@ def assert_function(x):
assert isinstance(df, tb.BeliefsDataFrame)
for md in metadata:
assert getattr(df, md) == metadata[md]


def test_groupby_retains_attribute():
df = pd.DataFrame([[1, 2], [3, 4]], columns=["x", "y"])
df.a = "b"
assert df.a == "b"
df = df.groupby("x").apply(lambda x: x)
assert df.a == "b"
df = df.groupby("x").sum()
assert df.a == "b"

0 comments on commit 2788bd7

Please sign in to comment.