Test encoding a simple Pydantic model.
(self)
| 15 | """Tests for encode_pydantic function.""" |
| 16 | |
| 17 | def test_simple_model(self): |
| 18 | """Test encoding a simple Pydantic model.""" |
| 19 | class User(BaseModel): |
| 20 | id: int |
| 21 | name: str |
| 22 | email: str |
| 23 | |
| 24 | user = User(id=1, name='Alice', email='alice@example.com') |
| 25 | toon = encode_pydantic(user) |
| 26 | |
| 27 | assert 'id: 1' in toon |
| 28 | assert 'name: Alice' in toon |
| 29 | assert 'email: alice@example.com' in toon |
| 30 | |
| 31 | def test_list_of_models_tabular(self): |
| 32 | """Test encoding a list of uniform Pydantic models (tabular format).""" |
nothing calls this directly
no test coverage detected