From bfc39db652b40f9428431c1bbeb329ba21d2359c Mon Sep 17 00:00:00 2001 From: Chahrazad650 Date: Tue, 10 Feb 2026 01:25:00 +0100 Subject: [PATCH] ajout de la fonction informations --- main.py | 15 +++++++++++++++ test_main.py | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/main.py b/main.py index 5de32eb..a0a06c0 100644 --- a/main.py +++ b/main.py @@ -171,6 +171,21 @@ class _ScraperData: def getdata(self) -> dict[str, object]: return self._data + def informations(self) -> str: + """ + Retourne toutes les informations sous la forme : + "Appelation,Parker,J.Robinson,J.Suckling,Prix" + """ + + appellation = self.appellation() + parker = self.parker() + robinson = self.robinson() + suckling = self.suckling() + prix = self.prix() + + return f"{appellation},{parker},{robinson},{suckling},{prix}" + + class Scraper: """ diff --git a/test_main.py b/test_main.py index 162db92..be5f703 100644 --- a/test_main.py +++ b/test_main.py @@ -240,3 +240,7 @@ def test_prix(scraper: Scraper): assert contenu.prix() == 65.0 +def test_informations(scraper: Scraper): + contenu = scraper.getjsondata("nino-negri-5-stelle-sfursat-2022.html") + assert contenu.informations() == "Sforzato di Valtellina,91,17,93.5,65.0" +