From 8dfc71a8844b3fdfab2de104f8556cb822f89b49 Mon Sep 17 00:00:00 2001 From: Allan Galarza Date: Wed, 18 Sep 2019 21:14:25 -0700 Subject: [PATCH 1/3] Fixed bug with death parsing - Assist were not being parsed if a player had "and" in their name. --- tibiapy/character.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tibiapy/character.py b/tibiapy/character.py index 41de3f89..2c84c2de 100644 --- a/tibiapy/character.py +++ b/tibiapy/character.py @@ -22,6 +22,7 @@ death_assisted = re.compile(r'(?P.+)\.
Assisted by (?P.+)') # From a killer entry, extracts the summoned creature death_summon = re.compile(r'(?P.+) of ]+>(?P[^<]+)') +link_search = re.compile(r']+>[^<]+') # Extracts the contents of a tag link_content = re.compile(r'>([^<]+)<') # Extracts reason from TibiaData death @@ -551,7 +552,8 @@ def _parse_deaths(self, rows): # Filter out assists killers_desc = assist_match.group("killers") # Split assists into a list. - assists_name_list = self._split_list(assist_match.group("assists")) + assists_desc = assist_match.group("assists") + assists_name_list = link_search.findall(assists_desc) killers_name_list = self._split_list(killers_desc) for killer in killers_name_list: killer_dict = self._parse_killer(killer) From 425af8b56db1ed841c10e243abc64db25ed79120 Mon Sep 17 00:00:00 2001 From: Allan Galarza Date: Thu, 19 Sep 2019 18:25:32 -0700 Subject: [PATCH 2/3] Fix tests name conflict --- tests/tests_world.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/tests_world.py b/tests/tests_world.py index 3558b7d5..1344d6e0 100644 --- a/tests/tests_world.py +++ b/tests/tests_world.py @@ -215,7 +215,7 @@ def test_world_tibiadata_unrelated_section(self): # region TibiaData WorldOverview Tests - def test_world_overview_from_content(self): + def test_world_overview_from_content_tibiadata(self): """Testing parsing the world overview from TibiaData""" content = self._load_resource(FILE_WORLD_LIST_TIBIADATA) world_overview = WorldOverview.from_tibiadata(content) @@ -230,7 +230,7 @@ def test_world_overview_from_content(self): self.assertIsInstance(world_overview.worlds[0].location, WorldLocation) self.assertIsInstance(world_overview.worlds[0].online_count, int) - def test_world_overview_from_content_offline(self): + def test_listed_world_list_from_tibiadata_offline(self): """Testing parsing the world overview with offline worlds""" content = self._load_resource(FILE_WORLD_LIST_TIBIADATA_OFFLINE) worlds = ListedWorld.list_from_tibiadata(content) @@ -243,13 +243,13 @@ def test_world_overview_from_content_offline(self): self.assertIsInstance(worlds[0].location, WorldLocation) self.assertIsInstance(worlds[0].online_count, int) - def test_world_overview_from_content_unrelated(self): + def test_listed_world_list_from_tibiadata_unrelated(self): """Testing parsing an unrelated json""" content = self._load_resource(FILE_WORLD_TIBIADATA) with self.assertRaises(InvalidContent): ListedWorld.list_from_tibiadata(content) - def test_world_overview_from_content_invalid_json(self): + def test_listed_world_list_from_tibiadata_invalid_json(self): """Testing parsing an invalid json""" with self.assertRaises(InvalidContent): ListedWorld.list_from_tibiadata("Not a json string") From da4f2ea766bb104c05a6999082377eecdf8b5bcf Mon Sep 17 00:00:00 2001 From: Allan Galarza Date: Sun, 6 Oct 2019 20:32:15 -0700 Subject: [PATCH 3/3] Updated changelog and version --- CHANGELOG.rst | 6 ++++++ tibiapy/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5ee95d1c..79c29a52 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,12 @@ Changelog Due to this library relying on external content, older versions are not guaranteed to work. Try to always use the latest version. +.. _v2.3.1: + +2.3.1 (2019-10-06) +================== +- Fixed a bug with deaths not being parsed when a killer had ``and`` in their name. + .. _v2.3.0: 2.3.0 (2019-09-16) diff --git a/tibiapy/__init__.py b/tibiapy/__init__.py index e17ee2b1..34478576 100644 --- a/tibiapy/__init__.py +++ b/tibiapy/__init__.py @@ -13,7 +13,7 @@ from tibiapy.creature import * from tibiapy.client import * -__version__ = '2.3.0' +__version__ = '2.3.1' from logging import NullHandler