Fix generating pytest for training service

This commit is contained in:
Urtzi Alfaro
2025-07-25 14:10:27 +02:00
parent 0dc12f4b93
commit e2b85162f0
14 changed files with 151 additions and 7448 deletions

View File

@@ -25,13 +25,16 @@ class TestBakeryDataProcessor:
@pytest.fixture
def sample_sales_data(self):
"""Create sample sales data"""
dates = pd.date_range('2024-01-01', periods=60, freq='D')
return pd.DataFrame({
'date': dates,
'product_name': ['Pan Integral'] * 60,
'quantity': [45 + np.random.randint(-10, 11) for _ in range(60)]
})
"""Provide sufficient data for ML training tests"""
dates = pd.date_range('2024-01-01', periods=35, freq='D') # 35 days > 30 minimum
data = []
for date in dates:
data.append({
'date': date,
'product_name': 'Pan Integral', # Ensure this column exists
'quantity': 40 + (5 * np.sin(date.dayofyear / 365 * 2 * np.pi)) # Seasonal pattern
})
return pd.DataFrame(data)
@pytest.fixture
def sample_weather_data(self):