Spaces:
Sleeping
Sleeping
| """Shared fixtures for the data_cleaning_env test suite.""" | |
| from __future__ import annotations | |
| import pandas as pd | |
| import pytest | |
| def clean_df() -> pd.DataFrame: | |
| """Minimal clean DataFrame for unit tests.""" | |
| return pd.DataFrame( | |
| { | |
| "a": [1, 2, 3, 4, 5], | |
| "b": ["x", "y", "z", "x", "y"], | |
| "c": [10.0, 20.0, 30.0, 40.0, 50.0], | |
| } | |
| ) | |
| def dirty_df(clean_df: pd.DataFrame) -> pd.DataFrame: | |
| """Dirty version of clean_df with a missing value and a type error.""" | |
| import numpy as np | |
| df = clean_df.copy() | |
| df.loc[0, "a"] = np.nan | |
| df["c"] = df["c"].astype(object) | |
| df.loc[2, "c"] = "err_30.0" | |
| return df | |