Example: Simple Pydantic model to TOON.
()
| 46 | |
| 47 | |
| 48 | def example_simple_model(): |
| 49 | """Example: Simple Pydantic model to TOON.""" |
| 50 | print("=== Simple Pydantic Model ===") |
| 51 | |
| 52 | user = User( |
| 53 | id=1, |
| 54 | name='Alice Smith', |
| 55 | email='alice@example.com', |
| 56 | age=30, |
| 57 | active=True |
| 58 | ) |
| 59 | |
| 60 | print("Python object:") |
| 61 | print(f" {user}") |
| 62 | print() |
| 63 | |
| 64 | toon = encode_pydantic(user) |
| 65 | print("TOON format:") |
| 66 | print(toon) |
| 67 | print() |
| 68 | |
| 69 | |
| 70 | def example_list_of_models(): |
no test coverage detected
searching dependent graphs…