Skip to content

Commit 7b9eaed

Browse files
committed
Removed TibiaData features
1 parent d77cfec commit 7b9eaed

17 files changed

+17
-1189
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Changelog
3333
- Removed support for Python 3.5.
3434
- Changed the hierarchy of base classes. Base classes no longer implement ``Serializable``, ``Serializable`` is now
3535
directly implemented by most classes.
36-
36+
- Removed TibiaData functionality.
3737

3838
.. _v2.5.1:
3939

docs/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Tibia.py
99

1010

1111
Tibia.py is a library for parsing HTML content from Tibia.com_. into Python objects.
12-
It can also parse json content from TibiaData_.
1312

1413
**Features:**
1514

@@ -22,7 +21,6 @@ It can also parse json content from TibiaData_.
2221

2322

2423
.. _Tibia.com: https://www.tibia.com/news/?subtopic=latestnews
25-
.. _TibiaData: https://www.tibiadata.com/
2624
.. _aiohttp: https://aiohttp.readthedocs.io/en/stable/
2725

2826

docs/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ The asynchronous client (:class:`tibiapy.Client`) contains methods to obtain inf
3939

4040
The parsing methods allow you to get Python objects given the html content of a page.
4141

42-
The main models have a ``get_url``/``get_url_tibiadata`` method that can be used to get their Tibia.com/TibiaData.com page.
43-
With the url, the html/json content can be fetched and then passed to their ``from_content``/``from_tibiadata`` methods.
42+
The main models have a ``get_url`` method that can be used to get their Tibia.com page.
43+
With the url, the html/json content can be fetched and then passed to their ``from_content`` methods.
4444

4545
This allows you to use any networking module to obtain the data, and use the library to parse it.
4646

tests/tests_character.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
FILE_CHARACTER_MULTIPLE_HOUSES = "character/tibiacom_multiple_houses.txt"
1919
FILE_CHARACTER_TRUNCATED_DEATHS = "character/tibiacom_truncated_deaths.txt"
2020

21-
FILE_CHARACTER_TIBIADATA = "character/tibiadata.json"
22-
FILE_CHARACTER_TIBIADATA_UNHIDDEN = "character/tibiadata_unhidden.json"
23-
FILE_CHARACTER_TIBIADATA_DELETED = "character/tibiadata_deleted.json"
24-
FILE_CHARACTER_TIBIADATA_SPECIAL_POSITION = "character/tibiadata_special_position.json"
25-
FILE_CHARACTER_TIBIADATA_NOT_FOUND = "character/tibiadata_not_found.json"
26-
FILE_CHARACTER_TIBIADATA_DEATHS_SUMMON = "character/tibiadata_deaths_summon.json"
27-
2821

2922
class TestCharacter(TestCommons, unittest.TestCase):
3023
def _compare_character(self, mock_character, character):
@@ -175,84 +168,3 @@ def test_death_types(self):
175168
self.assertEqual(spawn_invasion.killer, spawn_invasion.killers[0])
176169
self.assertIsNone(spawn_invasion.killer.url)
177170
self.assertTrue(spawn_invasion.by_player)
178-
179-
# region TibiaData Character tests
180-
181-
def test_character_from_tibiadata(self):
182-
"""Testing parsing TibiaData content"""
183-
content = self.load_resource(FILE_CHARACTER_TIBIADATA)
184-
char = Character.from_tibiadata(content)
185-
186-
self.assertEqual(char.url_tibiadata, Character.get_url_tibiadata(char.name))
187-
self.assertIsInstance(char, Character)
188-
self.assertIsNotNone(char.guild_name)
189-
self.assertIsInstance(char.last_login, datetime.datetime)
190-
191-
self.assertIsInstance(char.houses[0], CharacterHouse)
192-
self.assertEqual(char.houses[0].owner, char.name)
193-
self.assertEqual(char.houses[0].town, "Ankrahmun")
194-
self.assertEqual(char.houses[0].world, char.world)
195-
self.assertIsInstance(char.houses[0].paid_until_date, datetime.date)
196-
197-
self.assertTrue(char.deaths[3].by_player)
198-
199-
def test_character_from_tibiadata_unhidden(self):
200-
"""Testing parsing an unhidden character"""
201-
content = self.load_resource(FILE_CHARACTER_TIBIADATA_UNHIDDEN)
202-
char = Character.from_tibiadata(content)
203-
204-
self.assertIsNotNone(char.account_information)
205-
self.assertTrue(char.other_characters)
206-
self.assertFalse(char.hidden)
207-
208-
self.assertIsInstance(char.houses[0], CharacterHouse)
209-
self.assertEqual(char.houses[0].owner, char.name)
210-
self.assertEqual(char.houses[0].town, "Kazordoon")
211-
self.assertEqual(char.houses[0].world, char.world)
212-
self.assertIsInstance(char.houses[0].paid_until_date, datetime.date)
213-
214-
def test_character_from_tibiadata_deleted(self):
215-
"""Testing parsing a deleted character"""
216-
content = self.load_resource(FILE_CHARACTER_TIBIADATA_DELETED)
217-
char = Character.from_tibiadata(content)
218-
219-
self.assertEqual(char.url_tibiadata, Character.get_url_tibiadata(char.name))
220-
self.assertIsInstance(char, Character)
221-
self.assertTrue(char.deleted)
222-
self.assertIsInstance(char.deletion_date, datetime.datetime)
223-
self.assertIsNone(char.guild_name)
224-
self.assertIsNone(char.last_login)
225-
226-
def test_character_from_tibiadata_position(self):
227-
"""Testing parsing a character with position"""
228-
content = self.load_resource(FILE_CHARACTER_TIBIADATA_SPECIAL_POSITION)
229-
char = Character.from_tibiadata(content)
230-
self.assertEqual(char.name, "Steve")
231-
self.assertEqual(char.position, "CipSoft Member")
232-
self.assertEqual(char.account_information.position, "CipSoft Member")
233-
234-
def test_character_from_tibiadata_summon_deaths(self):
235-
"""Testing parsing a character with summon deaths"""
236-
content = self.load_resource(FILE_CHARACTER_TIBIADATA_DEATHS_SUMMON)
237-
char = Character.from_tibiadata(content)
238-
self.assertTrue(char.deaths)
239-
240-
summon_death = char.deaths[2]
241-
self.assertTrue(summon_death.killers[2].summon, "a fire elemental")
242-
self.assertTrue(summon_death.killers[2].name, "Hasi Pupsi")
243-
244-
def test_character_from_tibiadata_not_found(self):
245-
"""Testing parsing a not found character"""
246-
content = self.load_resource(FILE_CHARACTER_TIBIADATA_NOT_FOUND)
247-
char = Character.from_tibiadata(content)
248-
self.assertIsNone(char)
249-
250-
def test_character_from_tibiadata_invalid_json(self):
251-
"""Testing parsing an invalid JSON string"""
252-
with self.assertRaises(InvalidContent):
253-
Character.from_tibiadata("<html><b>Not a json string</b></html>")
254-
255-
def test_character_from_tibiadata_unrelated_json(self):
256-
"""Testing parsing an unrelated TibiaData section"""
257-
with self.assertRaises(InvalidContent):
258-
Character.from_tibiadata(self.load_resource(tests.tests_guild.FILE_GUILD_TIBIADATA))

tests/tests_guild.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
FILE_GUILD_LIST_NOT_FOUND = "guild/tibiacom_list_not_found.txt"
1616
FILE_GUILD_IN_WAR = "guild/tibiacom_war.txt"
1717

18-
FILE_GUILD_TIBIADATA = "guild/tibiadata.json"
19-
FILE_GUILD_TIBIADATA_NOT_FOUND = "guild/tibiadata_not_found.json"
20-
FILE_GUILD_TIBIADATA_DISBANDING = "guild/tibiadata_disbanding.json"
21-
FILE_GUILD_TIBIADATA_INVITED = "guild/tibiadata_invited.json"
22-
FILE_GUILD_TIBIADATA_LIST = "guild/tibiadata_list.json"
23-
FILE_GUILD_TIBIADATA_LIST_NOT_FOUND = "guild/tibiadata_list_not_found.json"
24-
2518
FILE_GUILD_WAR_ACTIVE_HISTORY = "guild/wars/tibiacom_active_history.txt"
2619
FILE_GUILD_WAR_EMPTY = "guild/wars/tibiacom_empty.txt"
2720
FILE_GUILD_WAR_UNACTIVE_HISTORY = "guild/wars/tibiacom_unactive_history.txt"
@@ -38,7 +31,6 @@ def test_guild_from_content(self):
3831
self.assertIsInstance(guild, Guild, "Guild should be a Guild object.")
3932
self.assertEqual(guild.url, Guild.get_url(guild.name))
4033
self.assertEqual(guild.url_wars, Guild.get_url_wars(guild.name))
41-
self.assertEqual(guild.url_tibiadata, Guild.get_url_tibiadata(guild.name))
4234
self.assertTrue(guild.active, "Guild should be active")
4335
self.assertIsInstance(guild.founded, datetime.date, "Guild founded date should be an instance of datetime.date")
4436
self.assertTrue(guild.open_applications, "Guild applications should be open")
@@ -211,78 +203,6 @@ def test_guild_init_founded(self):
211203
self.assertIsNone(Guild(founded=None).founded)
212204
self.assertIsNone(Guild(founded="Jul 20").founded)
213205

214-
def test_guild_from_tibiadata(self):
215-
"""Testing parsing a guild from TibiaData"""
216-
content = self.load_resource(FILE_GUILD_TIBIADATA)
217-
guild = Guild.from_tibiadata(content)
218-
219-
self.assertIsInstance(guild, Guild)
220-
self.assertTrue(guild.open_applications)
221-
self.assertIsNotNone(guild.guildhall)
222-
self.assertEqual(guild.founded, datetime.date(2002, 2, 18))
223-
self.assertIsInstance(guild.guildhall, GuildHouse)
224-
self.assertEqual(guild.guildhall.world, guild.world)
225-
self.assertIsNotNone(guild.logo_url)
226-
227-
def test_guild_from_tibiadata_not_found(self):
228-
"""Testing parsing a non existent guild"""
229-
content = self.load_resource(FILE_GUILD_TIBIADATA_NOT_FOUND)
230-
guild = Guild.from_tibiadata(content)
231-
self.assertIsNone(guild)
232-
233-
def test_guild_from_tibiadata_disbanding(self):
234-
"""Testing parsing a disbanding guild from TibiaData"""
235-
content = self.load_resource(FILE_GUILD_TIBIADATA_DISBANDING)
236-
guild = Guild.from_tibiadata(content)
237-
self.assertIsNotNone(guild.disband_condition)
238-
self.assertEqual(guild.disband_date, datetime.date(2018, 12, 26))
239-
240-
def test_guild_from_tibiadata_with_invites(self):
241-
"""Testing parsing a guild with invites"""
242-
content = self.load_resource(FILE_GUILD_TIBIADATA_INVITED)
243-
guild = Guild.from_tibiadata(content)
244-
self.assertTrue(len(guild.invites) > 0)
245-
self.assertIsInstance(guild.invites[0], GuildInvite)
246-
247-
def test_guild_from_tibiadata_invalid_json(self):
248-
"""Testing parsing an invalid json"""
249-
with self.assertRaises(InvalidContent):
250-
Guild.from_tibiadata("<html><p>definitely not a json string</p></html>")
251-
252-
def test_guild_from_tibiadata_unrelated_section(self):
253-
"""Testing parsing a different TibiaData json"""
254-
content = self.load_resource(tests.tests_character.FILE_CHARACTER_TIBIADATA)
255-
with self.assertRaises(InvalidContent):
256-
Guild.from_tibiadata(content)
257-
258-
def test_listed_guild_from_tibiadata(self):
259-
"""Testing parsing a guild list from TibiaData"""
260-
content = self.load_resource(FILE_GUILD_TIBIADATA_LIST)
261-
guilds = ListedGuild.list_from_tibiadata(content)
262-
self.assertTrue(guilds)
263-
self.assertIsNotNone(ListedGuild.get_world_list_url_tibiadata(guilds[0].world))
264-
self.assertEqual("Zunera", guilds[0].world)
265-
self.assertIsInstance(guilds[0], ListedGuild)
266-
self.assertTrue(guilds[0].active)
267-
self.assertFalse(guilds[-1].active)
268-
269-
def test_listed_guild_from_tibiadata_not_found(self):
270-
"""Testing parsing a non existent guild"""
271-
content = self.load_resource(FILE_GUILD_TIBIADATA_LIST_NOT_FOUND)
272-
guilds = ListedGuild.list_from_tibiadata(content)
273-
# There's no way to tell if the searched world doesn't exist or has no guilds
274-
self.assertEqual(guilds, [])
275-
276-
def test_listed_guild_from_tibiadata_unrelated_section(self):
277-
"""Testing parsing an unrelated section"""
278-
content = self.load_resource(tests.tests_character.FILE_CHARACTER_TIBIADATA)
279-
with self.assertRaises(InvalidContent):
280-
ListedGuild.list_from_tibiadata(content)
281-
282-
def test_listed_guild_from_tibiadata_invalid_json(self):
283-
"""Testing parsing an invalid json"""
284-
with self.assertRaises(InvalidContent):
285-
ListedGuild.list_from_tibiadata("<b>Not JSON</b>")
286206

287207
# region Guild War Tests
288208
def test_guild_wars_from_content_active_history(self):

tests/tests_highscores.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
FILE_HIGHSCORES_EMPTY = "highscores/tibiacom_empty.txt"
1313
FILE_HIGHSCORES_NO_RESULTS = "highscores/tibiacom_no_results.txt"
1414

15-
FILE_HIGHSCORES_TIBIADATA_FULL = "highscores/tibiadata_full.json"
16-
FILE_HIGHSCORES_TIBIADATA_EXPERIENCE = "highscores/tibiadata_experience.json"
17-
FILE_HIGHSCORES_TIBIADATA_LOYALTY = "highscores/tibiadata_loyalty.json"
18-
FILE_HIGHSCORES_TIBIADATA_EMPTY = "highscores/tibiadata_empty.json"
19-
2015

2116
class TestHighscores(unittest.TestCase, TestCommons):
2217
# region Tibia.com Tests
@@ -110,74 +105,3 @@ def test_highscores_from_content_unrelated_section(self):
110105
Highscores.from_content(content)
111106

112107
# endregion
113-
114-
# region TibiaData.com Tests
115-
def _test_highscores_from_tibiadata(self):
116-
"""Testing parsing highscores from TibiaData"""
117-
content = self.load_resource(FILE_HIGHSCORES_TIBIADATA_FULL)
118-
highscores = Highscores.from_tibiadata(content)
119-
120-
self.assertEqual(highscores.world, "Antica")
121-
self.assertEqual(highscores.vocation, VocationFilter.ALL)
122-
self.assertEqual(highscores.category, Category.AXE_FIGHTING)
123-
self.assertEqual(highscores.results_count, 300)
124-
125-
self.assertEqual(highscores.url_tibiadata,
126-
Highscores.get_url_tibiadata(highscores.world, highscores.category, highscores.vocation))
127-
128-
for entry in highscores.entries:
129-
self.assertIsInstance(entry, HighscoresEntry)
130-
self.assertIsInstance(entry.name, str)
131-
self.assertIsInstance(entry.vocation, Vocation)
132-
self.assertIsInstance(entry.rank, int)
133-
self.assertIsInstance(entry.value, int)
134-
135-
def test_highscores_from_tibiadata_experience(self):
136-
"""Testing parsing experience highscores"""
137-
content = self.load_resource(FILE_HIGHSCORES_TIBIADATA_EXPERIENCE)
138-
highscores = Highscores.from_tibiadata(content)
139-
140-
self.assertEqual(highscores.world, "Luminera")
141-
self.assertEqual(highscores.vocation, VocationFilter.ALL)
142-
self.assertEqual(highscores.category, Category.EXPERIENCE)
143-
self.assertEqual(highscores.results_count, 300)
144-
145-
for entry in highscores.entries:
146-
self.assertIsInstance(entry, ExpHighscoresEntry)
147-
self.assertIsInstance(entry.name, str)
148-
self.assertIsInstance(entry.vocation, Vocation)
149-
self.assertIsInstance(entry.rank, int)
150-
self.assertIsInstance(entry.value, int)
151-
self.assertIsInstance(entry.level, int)
152-
153-
def _test_highscores_from_tibiadata_loyalty(self):
154-
"""Testing parsing loyalty highscores"""
155-
content = self.load_resource(FILE_HIGHSCORES_TIBIADATA_LOYALTY)
156-
highscores = Highscores.from_tibiadata(content)
157-
158-
self.assertEqual(highscores.world, "Zunera")
159-
self.assertEqual(highscores.vocation, VocationFilter.ALL)
160-
self.assertEqual(highscores.category, Category.LOYALTY_POINTS)
161-
self.assertEqual(highscores.results_count, 57)
162-
163-
for entry in highscores.entries:
164-
self.assertIsInstance(entry, LoyaltyHighscoresEntry)
165-
self.assertIsInstance(entry.name, str)
166-
self.assertIsInstance(entry.vocation, Vocation)
167-
self.assertIsInstance(entry.rank, int)
168-
self.assertIsInstance(entry.value, int)
169-
self.assertIsInstance(entry.title, str)
170-
171-
def test_highscores_from_tibiadata_empty(self):
172-
"""Testing parsing empty highscores"""
173-
content = self.load_resource(FILE_HIGHSCORES_TIBIADATA_EMPTY)
174-
highscores = Highscores.from_tibiadata(content)
175-
176-
self.assertIsNone(highscores)
177-
178-
def test_highscores_from_tibiadata_unrelated_section(self):
179-
"""Testing parsing an unrelated section"""
180-
with self.assertRaises(InvalidContent):
181-
Highscores.from_tibiadata(self.load_resource(tests.tests_character.FILE_CHARACTER_TIBIADATA))
182-
183-
# endregion

0 commit comments

Comments
 (0)