Spaces:
Running
Running
File size: 2,466 Bytes
85fcbc2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | """Smoke tests for the Streamlit app."""
import pytest
from pathlib import Path
import sys
class TestAppImports:
"""Test that app can be imported without errors."""
def test_yaml_importable(self):
"""YAML library is available."""
import yaml
assert yaml is not None
def test_pandas_importable(self):
"""Pandas is available."""
import pandas as pd
assert pd is not None
def test_plotly_importable(self):
"""Plotly is available."""
import plotly.graph_objects as go
assert go is not None
class TestConfigLoading:
"""Test that product configs can be loaded."""
def test_products_directory_exists(self, products_dir):
"""Products directory exists."""
assert products_dir.exists()
assert products_dir.is_dir()
def test_at_least_one_product(self, all_configs):
"""At least one product config exists."""
assert len(all_configs) > 0
def test_besafe_config_loadable(self, besafe_config):
"""BeSafe config loads successfully."""
assert besafe_config is not None
assert "product" in besafe_config
def test_hamax_config_loadable(self, hamax_config):
"""Hamax config loads successfully."""
assert hamax_config is not None
assert "product" in hamax_config
class TestProductDetails:
"""Test product-specific details are correct."""
def test_besafe_is_car_seat(self, besafe_config):
"""BeSafe is categorized as car seat."""
assert besafe_config["product"]["category"] == "car_seat"
def test_hamax_is_bicycle_trailer(self, hamax_config):
"""Hamax is categorized as bicycle trailer."""
assert hamax_config["product"]["category"] == "bicycle_trailer"
def test_products_have_images(self, all_configs):
"""All products have image URLs."""
for name, config in all_configs.items():
assert "image_url" in config["product"], f"{name}: Missing image_url"
assert config["product"]["image_url"].startswith("http"), \
f"{name}: image_url should be a URL"
def test_products_have_features(self, all_configs):
"""All products have feature lists."""
for name, config in all_configs.items():
assert "features" in config["product"], f"{name}: Missing features"
assert len(config["product"]["features"]) > 0, f"{name}: Empty features list"
|