From 102644296aa872bc8ac61fb1df7e68ca5fddfdea Mon Sep 17 00:00:00 2001 From: sebthom Date: Mon, 4 Apr 2022 12:58:59 +0200 Subject: [PATCH] Don't require price for GIVE_AWAY ads #52 --- kleinanzeigen_bot/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kleinanzeigen_bot/__init__.py b/kleinanzeigen_bot/__init__.py index 30f2e66..efae1a7 100644 --- a/kleinanzeigen_bot/__init__.py +++ b/kleinanzeigen_bot/__init__.py @@ -237,13 +237,13 @@ class KleinanzeigenBot(SeleniumMixin): ensure(safe_get(ad_cfg, *path.split(".")), f"-> property [{path}] not specified @ [{ad_file}]") # pylint: enable=cell-var-from-loop - assert_one_of("type", ("OFFER", "WANTED")) + assert_one_of("type", {"OFFER", "WANTED"}) assert_min_len("title", 10) assert_has_value("description") - assert_one_of("price_type", ("FIXED", "NEGOTIABLE", "GIVE_AWAY", "NOT_APPLICABLE")) - if ad_cfg["price_type"] != "NOT_APPLICABLE": + assert_one_of("price_type", {"FIXED", "NEGOTIABLE", "GIVE_AWAY", "NOT_APPLICABLE"}) + if not ad_cfg["price_type"] in {"GIVE_AWAY", "NOT_APPLICABLE"}: assert_has_value("price") - assert_one_of("shipping_type", ("PICKUP", "SHIPPING", "NOT_APPLICABLE")) + assert_one_of("shipping_type", {"PICKUP", "SHIPPING", "NOT_APPLICABLE"}) assert_has_value("contact.name") assert_has_value("republication_interval")