Skip to content

Commit

Permalink
Merge pull request #21 from Galarzaa90/dev
Browse files Browse the repository at this point in the history
v2.3.1
  • Loading branch information
Galarzaa90 authored Oct 7, 2019
2 parents 04944c3 + da4f2ea commit 6ae8185
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/tests_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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("<html><b>Not a json string</b></html>")
Expand Down
2 changes: 1 addition & 1 deletion tibiapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tibiapy.creature import *
from tibiapy.client import *

__version__ = '2.3.0'
__version__ = '2.3.1'

from logging import NullHandler

Expand Down
4 changes: 3 additions & 1 deletion tibiapy/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
death_assisted = re.compile(r'(?P<killers>.+)\.<br/>Assisted by (?P<assists>.+)')
# From a killer entry, extracts the summoned creature
death_summon = re.compile(r'(?P<summon>.+) of <a[^>]+>(?P<name>[^<]+)</a>')
link_search = re.compile(r'<a[^>]+>[^<]+</a>')
# Extracts the contents of a tag
link_content = re.compile(r'>([^<]+)<')
# Extracts reason from TibiaData death
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6ae8185

Please sign in to comment.