Пример #1
0
 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
     )
Пример #2
0
 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")