I have a function with optional field url
def create_ads_task(
template_id: int,
ad_account_id: str,
adset_ids: List[str],
placements: Dict[str, str],
locales: List[Locale],
url: Optional[HttpUrl],
) -> List[Dict[str, Union[str, int]]]:
...body...
When I run the tests, I get an error
E TypeError: create_ads_task() missing 1 required positional argument: 'url'
test.py
assert create_ads_task(
TEMPLATE_ID, AD_ACCOUNT_ID, ADSET_IDS, PLACEMENTS, LOCALES
) == [ ..... ]
How to fix test I now, but I cant understand why optional field is required. The function does not always need the url parameter, sometimes it is not passed from the frontend. How do I define the optional parameter correctly?