mirror of
https://github.com/guezoloic/millesima_projetS6.git
synced 2026-03-28 19:13:42 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9914e8af41 | |||
|
|
5785d571b2 | ||
| 2bc5d57a31 | |||
| 8f21e48b28 | |||
|
|
9e0cb9737e |
6
main.py
6
main.py
@@ -6,9 +6,8 @@ from json import loads
|
||||
|
||||
|
||||
class _ScraperData:
|
||||
def __init__(self, data: dict[str, object], scraper: Scraper | None = None) -> None:
|
||||
def __init__(self, data: dict[str, object]) -> None:
|
||||
self._data: dict[str, object] = data
|
||||
self._scraper: Scraper | None = scraper
|
||||
|
||||
def _getcontent(self) -> dict[str, object] | None:
|
||||
"""_summary_
|
||||
@@ -221,4 +220,5 @@ class Scraper:
|
||||
continue
|
||||
raise ValueError(f"Clé manquante dans le JSON : {key}")
|
||||
|
||||
return _ScraperData(cast(dict[str, object], current_data))
|
||||
return _ScraperData(cast(dict[str, object], current_data))
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
requests>=2.32.5
|
||||
requests-mock>=1.12.1
|
||||
beautifulsoup4>=4.14.3
|
||||
|
||||
beautifulsoup4>=4.14.3
|
||||
13
test_main.py
13
test_main.py
@@ -105,6 +105,18 @@ def mock_site():
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"equivbtl": {
|
||||
"valueId": "1",
|
||||
"name": "equivbtl",
|
||||
"value": "1",
|
||||
"isSpirit": False,
|
||||
},
|
||||
"nbunit": {
|
||||
"valueId": "6",
|
||||
"name": "nbunit",
|
||||
"value": "6",
|
||||
"isSpirit": False,
|
||||
},
|
||||
"appellation": {
|
||||
"valueId": "433",
|
||||
"name": "Appellation",
|
||||
@@ -195,6 +207,7 @@ def test_fonctionprivee(scraper: Scraper):
|
||||
assert contenu._getattributes() is not None
|
||||
|
||||
|
||||
|
||||
def test_critiques(scraper: Scraper):
|
||||
vide = scraper.getjsondata("")
|
||||
poubelle = scraper.getjsondata("poubelle")
|
||||
|
||||
Reference in New Issue
Block a user