From c3499b38247d131c904eee55d2b3d9a6034e1c4e Mon Sep 17 00:00:00 2001 From: Jens Bergmann <1742418+1cu@users.noreply.github.com> Date: Sun, 22 Jun 2025 21:11:13 +0200 Subject: [PATCH] feat: add version to banner (#560) --- src/kleinanzeigen_bot/__init__.py | 10 ++++++---- tests/unit/test_extract.py | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/kleinanzeigen_bot/__init__.py b/src/kleinanzeigen_bot/__init__.py index b54e63f..8066b8c 100644 --- a/src/kleinanzeigen_bot/__init__.py +++ b/src/kleinanzeigen_bot/__init__.py @@ -833,7 +833,7 @@ class KleinanzeigenBot(WebScrapingMixin): img_items = await self.web_find_all(By.CSS_SELECTOR, "ul#j-pictureupload-thumbnails > li.ui-sortable-handle") for element in img_items: - btn = await self.web_find(By.CSS_SELECTOR, "button.pictureupload-thumbnails-remove", parent=element) + btn = await self.web_find(By.CSS_SELECTOR, "button.pictureupload-thumbnails-remove", parent = element) await btn.click() ############################# @@ -1052,7 +1052,7 @@ class KleinanzeigenBot(WebScrapingMixin): if mode == AdUpdateStrategy.MODIFY: try: # when "Andere Versandmethoden" is not available, go back and start over new - await self.web_find(By.XPATH, '//*[contains(@class, "CarrierSelectionModal")]//button[contains(., "Andere Versandmethoden")]', timeout=2) + await self.web_find(By.XPATH, '//*[contains(@class, "CarrierSelectionModal")]//button[contains(., "Andere Versandmethoden")]', timeout = 2) except TimeoutError: await self.web_click(By.XPATH, '//dialog//button[contains(., "Zurück")]') @@ -1081,7 +1081,8 @@ class KleinanzeigenBot(WebScrapingMixin): # only click on "Individueller Versand" when "IndividualShippingInput" is not available, otherwise its already checked # (important for mode = UPDATE) await self.web_find(By.XPATH, - '//*[contains(@class, "IndividualPriceSection")]//div[contains(@class, "IndividualShippingInput")]', timeout=2) + '//*[contains(@class, "IndividualPriceSection")]//div[contains(@class, "IndividualShippingInput")]', + timeout = 2) except TimeoutError: await self.web_click(By.XPATH, '//*[contains(@id, "INDIVIDUAL") and contains(@data-testid, "Individueller Versand")]') @@ -1298,7 +1299,7 @@ class KleinanzeigenBot(WebScrapingMixin): def main(args:list[str]) -> None: if "version" not in args: - print(textwrap.dedent(r""" + print(textwrap.dedent(rf""" _ _ _ _ _ _ | | _| | ___(_)_ __ __ _ _ __ _______(_) __ _ ___ _ __ | |__ ___ | |_ | |/ / |/ _ \ | '_ \ / _` | '_ \|_ / _ \ |/ _` |/ _ \ '_ \ ____| '_ \ / _ \| __| @@ -1306,6 +1307,7 @@ def main(args:list[str]) -> None: |_|\_\_|\___|_|_| |_|\__,_|_| |_/___\___|_|\__, |\___|_| |_| |_.__/ \___/ \__| |___/ https://github.com/Second-Hand-Friends/kleinanzeigen-bot + Version: {__version__} """)[1:], flush = True) # [1:] removes the first empty blank line loggers.configure_console_logging() diff --git a/tests/unit/test_extract.py b/tests/unit/test_extract.py index 330b422..312d3f3 100644 --- a/tests/unit/test_extract.py +++ b/tests/unit/test_extract.py @@ -433,7 +433,7 @@ class TestAdExtractorContent: raw_description, # Raw description (without affixes) "03.02.2025" # Creation date ]), - web_execute=AsyncMock(return_value={ + web_execute = AsyncMock(return_value = { "universalAnalyticsOpts": { "dimensions": { "dimension92": "", @@ -469,7 +469,7 @@ class TestAdExtractorContent: TimeoutError("Timeout"), # Description times out "03.02.2025" # Date succeeds ]), - web_execute=AsyncMock(return_value={ + web_execute = AsyncMock(return_value = { "universalAnalyticsOpts": { "dimensions": { "dimension92": "", @@ -604,7 +604,7 @@ class TestAdExtractorCategory: @pytest.mark.asyncio # pylint: disable=protected-access - async def test_extract_special_attributes_not_empty(self, extractor: AdExtractor) -> None: + async def test_extract_special_attributes_not_empty(self, extractor:AdExtractor) -> None: """Test extraction of special attributes when not empty.""" special_atts = {