yashmarathe's picture
refactor: move all root-level files to repo root
7492bfe
raw
history blame contribute delete
716 Bytes
"""Shared fixtures for the data_cleaning_env test suite."""
from __future__ import annotations
import pandas as pd
import pytest
@pytest.fixture
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],
}
)
@pytest.fixture
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