MCPcopy Create free account
hub / github.com/ScrapeGraphAI/toonify / test_exclude_unset

Method test_exclude_unset

tests/test_pydantic.py:77–95  ·  view source on GitHub ↗

Test excluding unset fields.

(self)

Source from the content-addressed store, hash-verified

75 assert 'zipcode: 02101' in toon
76
77 def test_exclude_unset(self):
78 """Test excluding unset fields."""
79 class Config(BaseModel):
80 host: str
81 port: int = 8080
82 debug: bool = False
83
84 config = Config(host='localhost')
85
86 # With exclude_unset=False (default)
87 toon_all = encode_pydantic(config, exclude_unset=False)
88 assert 'port: 8080' in toon_all
89 assert 'debug: false' in toon_all
90
91 # With exclude_unset=True
92 toon_set = encode_pydantic(config, exclude_unset=True)
93 assert 'host: localhost' in toon_set
94 assert 'port' not in toon_set
95 assert 'debug' not in toon_set
96
97 def test_exclude_none(self):
98 """Test excluding None values."""

Callers

nothing calls this directly

Calls 2

encode_pydanticFunction · 0.90
ConfigClass · 0.85

Tested by

no test coverage detected