Spaces:
Sleeping
Sleeping
Download tests/test_moodboard_analyzer.py from OneWeekApp/space-ac-design: direct link, hf CLI and curl.
- Browser
- Download file 2.41 kB
-
https://huggingface.co/spaces/OneWeekApp/space-ac-design/resolve/main/tests/test_moodboard_analyzer.py
- Command line
-
hf download hf://spaces/OneWeekApp/space-ac-design/tests/test_moodboard_analyzer.py
-
curl -L -o test_moodboard_analyzer.py https://huggingface.co/spaces/OneWeekApp/space-ac-design/resolve/main/tests/test_moodboard_analyzer.py
2.41 kB
| """ | |
| Tests for Moodboard Analyzer agent | |
| """ | |
| import sys | |
| sys.path.append('..') | |
| from agents.moodboard_analyzer import MoodboardAnalyzer | |
| def test_basic_analysis(): | |
| """Test basic moodboard analysis""" | |
| analyzer = MoodboardAnalyzer() | |
| input_data = { | |
| "reference_images": [ | |
| { | |
| "description": "Instagram home feed - dark mode with white text", | |
| "url": "" | |
| }, | |
| { | |
| "description": "Uber driver app - dark theme with green accents", | |
| "url": "" | |
| } | |
| ], | |
| "mood_keywords": ["gaming", "energetic", "modern"] | |
| } | |
| result = analyzer.process(input_data) | |
| assert "analysis" in result | |
| assert "color_palettes" in result["analysis"] | |
| assert "typography_trends" in result["analysis"] | |
| assert "ui_patterns" in result["analysis"] | |
| assert "insights" in result["analysis"] | |
| print("✅ Basic analysis test passed") | |
| print(f"Generated {len(result['analysis']['color_palettes'])} color palettes") | |
| print(f"Identified {len(result['analysis']['typography_trends'])} typography trends") | |
| def test_mock_analysis(): | |
| """Test mock analysis (no images)""" | |
| analyzer = MoodboardAnalyzer() | |
| input_data = { | |
| "reference_images": [], | |
| "mood_keywords": ["professional", "modern"] | |
| } | |
| result = analyzer.process(input_data) | |
| assert "analysis" in result | |
| assert len(result["analysis"]["color_palettes"]) > 0 | |
| print("✅ Mock analysis test passed") | |
| def test_color_palette_generation(): | |
| """Test color palette generation for different moods""" | |
| analyzer = MoodboardAnalyzer() | |
| moods = [ | |
| ["gaming", "energetic"], | |
| ["professional", "modern"], | |
| ["playful", "fun"] | |
| ] | |
| for mood in moods: | |
| input_data = { | |
| "reference_images": [], | |
| "mood_keywords": mood | |
| } | |
| result = analyzer.process(input_data) | |
| palettes = result["analysis"]["color_palettes"] | |
| print(f"✅ Generated {len(palettes)} palettes for mood: {mood}") | |
| for palette in palettes: | |
| print(f" - {palette['name']}: {palette['mood']}") | |
| if __name__ == "__main__": | |
| print("Running Moodboard Analyzer tests...\n") | |
| test_basic_analysis() | |
| print() | |
| test_mock_analysis() | |
| print() | |
| test_color_palette_generation() | |
| print() | |
| print("✅ All tests passed!") | |