def test_validate_list_str( self, provided: Any, optional: bool, required: bool, expected: Optional[List[str]], ) -> None: """Test _validate_list_str.""" assert ( BaseModel._validate_list_str(provided, optional=optional, required=required) == expected )
def test_validate_list_str_value_error(self) -> None: """Test _validate_list_str raise ValueError.""" with pytest.raises(ValueError): BaseModel._validate_list_str(None, required=True)
def test_validate_list_str_type_error(self) -> None: """Test _validate_list_str raise TypeError.""" with pytest.raises(TypeError): BaseModel._validate_list_str(["something", None]) with pytest.raises(TypeError): BaseModel._validate_list_str(1)