MCPcopy
hub / github.com/pydantic/pydantic / validate_value_nonzero

Method validate_value_nonzero

tests/test_generics.py:99–102  ·  view source on GitHub ↗
(cls, v: Any)

Source from the content-addressed store, hash-verified

97 @field_validator('data')
98 @classmethod
99 def validate_value_nonzero(cls, v: Any):
100 if any(x == 0 for x in v.values()):
101 raise ValueError('some value is zero')
102 return v
103
104 @model_validator(mode='after')
105 def validate_sum(self) -> 'Response[T]':

Callers

nothing calls this directly

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected