Skip to content

Commit 2923ce0

Browse files
committed
fix get_highscores_url not handling None values
1 parent c95c409 commit 2923ce0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

tests/tests_urls.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from tests.tests_tibiapy import TestCommons
2+
from tibiapy.urls import get_highscores_url
3+
4+
5+
class TestUrls(TestCommons):
6+
7+
def test_get_highscores_url_empty_params(self):
8+
url = get_highscores_url()
9+
10+
self.assertEqual("https://www.tibia.com/community/?subtopic=highscores&currentpage=1", url)

tibiapy/urls.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,13 @@ def get_highscores_url(
414414
"""
415415
pvp_types = pvp_types or []
416416
pvp_params = [("worldtypes[]", p.value) for p in pvp_types]
417-
return get_tibia_url("community", "highscores", *pvp_params, world=world, category=category.value,
418-
profession=vocation.value, currentpage=page,
419-
beprotection=battleye_type.value if battleye_type else None)
417+
return get_tibia_url("community", "highscores", *pvp_params,
418+
world=world,
419+
category=category.value if category else None,
420+
profession=vocation.value if vocation else None,
421+
currentpage=page,
422+
beprotection=battleye_type.value if battleye_type else None,
423+
)
420424

421425

422426
def get_kill_statistics_url(world: str) -> str:

0 commit comments

Comments
 (0)