-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import pytest | ||
|
||
from scraper.parsers.lzvcup import LZVCupParser | ||
|
||
config_ = { | ||
"base_url": "https://www.lzvcup.be", | ||
"area_name": "VLAAMS BRABANT", | ||
"area_url": "results/5", | ||
} | ||
parser = LZVCupParser(config_, region="Regio Ring Oost") | ||
|
||
|
||
def test_parse_region_cards_and_competitions_from_region_card(): | ||
region_cards = parser.parse_region_cards() | ||
regions = list(region_cards.keys()) | ||
|
||
assert regions == [ | ||
"Regio Dames Oost-Brabant", | ||
"Regio Hageland", | ||
"Regio Leuven", | ||
"Regio Leuven Studenten", | ||
"Regio Pajottenland", | ||
"Regio Ring Noord", | ||
"Regio Ring Oost", | ||
] | ||
|
||
competitions = parser.parse_competitions_from_region_card( | ||
region_cards[parser.region] | ||
) | ||
|
||
assert competitions.keys() == {"competitions", "sportshalls"} | ||
|
||
|
||
def test_parse_standings_and_stats(): | ||
dict_competitions = { | ||
"1e Klasse": { | ||
"url": "https://www.lzvcup.be/results/5/16/1", | ||
"teams": { | ||
"ZVC Vollentip": "https://www.lzvcup.be/teams/detail/365", | ||
"Oppem Boys": "https://www.lzvcup.be/teams/detail/1242", | ||
"The Crows": "https://www.lzvcup.be/teams/detail/1971", | ||
"Eppegem City": "https://www.lzvcup.be/teams/detail/1970", | ||
"Tervuren United": "https://www.lzvcup.be/teams/detail/551", | ||
}, | ||
}, | ||
"2e Klasse": { | ||
"url": "https://www.lzvcup.be/results/5/16/2", | ||
"teams": { | ||
"Aston Birra": "https://www.lzvcup.be/teams/detail/2001", | ||
"ZVC Copains": "https://www.lzvcup.be/teams/detail/1525", | ||
"Chiro Mik Mak": "https://www.lzvcup.be/teams/detail/1526", | ||
"FC Degradé": "https://www.lzvcup.be/teams/detail/2002", | ||
"The Blinders": "https://www.lzvcup.be/teams/detail/1605", | ||
}, | ||
}, | ||
} | ||
|
||
df_standings, df_stats, df_palmares = parser.parse_standings_and_stats( | ||
dict_competitions=dict_competitions, region=parser.region | ||
) | ||
|
||
assert len(df_standings) > 0 | ||
assert len(df_stats) > 0 | ||
assert len(df_palmares) > 0 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"url, region", | ||
[("https://www.lzvcup.be/sportshalls/16", "Regio Ring Oost")], | ||
) | ||
def test_parse_sporthalls(url, region): | ||
df = parser.parse_sporthalls(url_sportshalls=url, region=region) | ||
|
||
assert len(df) > 0 |