Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: cosmicBboy <[email protected]>
  • Loading branch information
cosmicBboy committed Dec 22, 2024
1 parent 333c6dd commit e78e342
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/core/test_decorators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Testing the Decorators that check a functions input or output."""

import pickle
import typing
from asyncio import AbstractEventLoop

Expand Down Expand Up @@ -1173,3 +1174,28 @@ async def check_coros() -> None:
await coro(bad_df)

event_loop.run_until_complete(check_coros())


class Schema(DataFrameModel):
column1: Series[int]
column2: Series[float]
column3: Series[str]


@check_types
def process_data_and_check_types(df: DataFrame[Schema]) -> DataFrame[Schema]:
# Example processing: add a new column
return df


def test_pickle_decorated_function(tmp_path):
path = tmp_path / "tmp.pkl"

with path.open("wb") as f:
pickle.dump(process_data_and_check_types, f)

with path.open("rb") as f:
_process_data_and_check_types = pickle.load(f)

# pylint: disable=comparison-with-callable
assert process_data_and_check_types == _process_data_and_check_types

0 comments on commit e78e342

Please sign in to comment.