def test_validate_int( self, provided: Any, optional: bool, required: bool, expected: Optional[int] ) -> None: """Test _validate_int.""" assert ( BaseModel._validate_int(provided, optional=optional, required=required) == expected )
def test_validate_int_value_error(self) -> None: """Test _validate_int raise ValueError.""" with pytest.raises(ValueError): BaseModel._validate_int(None, required=True) with pytest.raises(ValueError): BaseModel._validate_int("something")