Download tests/test_learning_node.py from fartec0/ai-learning-path-audio-sentiment: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/spaces/fartec0/ai-learning-path-audio-sentiment/resolve/main/tests/test_learning_node.py
- Command line
-
hf download hf://spaces/fartec0/ai-learning-path-audio-sentiment/tests/test_learning_node.py
-
curl -L -o test_learning_node.py https://huggingface.co/spaces/fartec0/ai-learning-path-audio-sentiment/resolve/main/tests/test_learning_node.py
2.13 kB
| """ | |
| Tests for LearningNode model. | |
| Following TDD principles - RED phase. | |
| """ | |
| import pytest | |
| from src.models.learning_node import LearningNode, NodeType | |
| class TestLearningNode: | |
| """Test cases for LearningNode class.""" | |
| def test_create_valid_learning_node(self): | |
| """Test creating a valid learning node.""" | |
| # RED: This test should pass after implementation | |
| node = LearningNode( | |
| id="llm-apis", | |
| title="LLM APIs", | |
| description="Understanding different types of LLMs and their APIs", | |
| node_type=NodeType.TOPIC, | |
| subtopics=["Types of LLMs", "Structured Outputs", "Prompt Caching", "Multi-modal models"], | |
| prerequisites=["basic-programming"], | |
| estimated_hours=20, | |
| resources=["https://example.com/llm-guide"] | |
| ) | |
| assert node.id == "llm-apis" | |
| assert node.title == "LLM APIs" | |
| assert node.node_type == NodeType.TOPIC | |
| assert len(node.subtopics) == 4 | |
| assert node.estimated_hours == 20 | |
| def test_empty_id_raises_error(self): | |
| """Test that empty ID raises ValueError.""" | |
| # RED: This test should fail initially | |
| with pytest.raises(ValueError, match="Node ID cannot be empty"): | |
| LearningNode( | |
| id="", | |
| title="Test Node", | |
| description="Test description", | |
| node_type=NodeType.TOPIC, | |
| subtopics=[], | |
| prerequisites=[], | |
| estimated_hours=10, | |
| resources=[] | |
| ) | |
| def test_empty_title_raises_error(self): | |
| """Test that empty title raises ValueError.""" | |
| # RED: This test should fail initially | |
| with pytest.raises(ValueError, match="Node title cannot be empty"): | |
| LearningNode( | |
| id="test-id", | |
| title="", | |
| description="Test description", | |
| node_type=NodeType.TOPIC, | |
| subtopics=[], | |
| prerequisites=[], | |
| estimated_hours=10, | |
| resources=[] | |
| ) | |