Skip to content

Commit

Permalink
Merge pull request #27 from Galarzaa90/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Galarzaa90 authored Feb 9, 2021
2 parents 509b7fe + 2d0c159 commit 29b4b44
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 46 deletions.
26 changes: 15 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
image: python:3.6
image: python:3.8

variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
GIT_DEPTH: 10
DOCKER_DRIVER: overlay2

before_script:
- python -m venv venv
- source venv/bin/activate
- pip install -U -e .
- pip install -U -e .[docs]
- pip install -U -e .[test]

stages:
- build
Expand All @@ -29,6 +26,7 @@ cache:
build:
stage: build
script:
- pip install -U -e .
- pip install wheel
- python setup.py sdist bdist_wheel
artifacts:
Expand All @@ -40,10 +38,11 @@ sonarcloud-check:
stage: analyze
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
entrypoint: [ "" ]
before_script:
- git fetch --unshallow origin +refs/heads/*:refs/remotes/origin/*
script:
- sonar-scanner
before_script: []
dependencies:
- coverage
only:
Expand All @@ -54,6 +53,7 @@ sonarcloud-check:
docs:
stage: build
script:
- pip install -U -e .[docs]
- cd docs
- make html
artifacts:
Expand All @@ -64,10 +64,11 @@ docs:
coverage:
stage: test
script:
- coverage run setup.py test
- coverage report
- coverage html
- coverage xml
- pip install -U -e .[test]
- coverage run setup.py test
- coverage report
- coverage html
- coverage xml
artifacts:
name: Coverage_Report
paths:
Expand All @@ -76,9 +77,12 @@ coverage:

pages:
stage: deploy
image: alpine
cache: { }
dependencies:
- docs
- coverage
before_script: [ ]
script:
- mkdir public
- mv htmlcov/ public/coverage/
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ Changelog
Due to this library relying on external content, older versions are not guaranteed to work.
Try to always use the latest version.

.. v3.7.0:
3.7.0 (2021-02-09)
==================

- Parse familiars from auctions
- Updated the way tooltips in auctions are parsed, the format changed, resulting in the previous code not working anymore.
- Results count in bazaar pages are now properly parsed when there are comma thousand separators.
- Item amounts are now more accurate instead of being based from their indicator (which was grouping them in thousands)


.. v3.6.5:
3.6.5 (2021-01-27)
Expand Down
12 changes: 12 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ CharmsEntry
:members:
:inherited-members:

DisplayFamiliar
~~~~~~~~~~~~~~~
.. autoclass:: DisplayFamiliar
:members:
:inherited-members:

DisplayItem
~~~~~~~~~~~
.. autoclass:: DisplayItem
Expand All @@ -562,6 +568,12 @@ DisplayOutfit
:members:
:inherited-members:

Familiars
~~~~~~~~~
.. autoclass:: Familiars
:members:
:inherited-members:

ItemSummary
~~~~~~~~~~~
.. autoclass:: ItemSummary
Expand Down
24 changes: 23 additions & 1 deletion tests/resources/bazaar/tibiacom_auction_finished.txt

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion tests/resources/bazaar/tibiacom_history.txt

Large diffs are not rendered by default.

40 changes: 24 additions & 16 deletions tests/tests_bazaar.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,28 @@ def test_character_bazaar_from_content_history(self):

self.assertIsNotNone(bazaar)
self.assertEqual(1, bazaar.page)
self.assertEqual(777, bazaar.total_pages)
self.assertEqual(19407, bazaar.results_count)
self.assertEqual(1449, bazaar.total_pages)
self.assertEqual(36219, bazaar.results_count)
self.assertEqual(25, len(bazaar.entries))
self.assertIsNotNone(bazaar.url)

auction = bazaar.entries[0]
self.assertEqual(1060, auction.auction_id)
self.assertEqual(752, auction.bid)
self.assertEqual("Maroze Loth", auction.name)
self.assertEqual(130, auction.level)
self.assertEqual("Pyra", auction.world)
self.assertEqual(Vocation.ELITE_KNIGHT, auction.vocation)
self.assertEqual(325058, auction.auction_id)
self.assertEqual(900, auction.bid)
self.assertEqual("Rcrazy Illuminati", auction.name)
self.assertEqual(255, auction.level)
self.assertEqual("Celebra", auction.world)
self.assertEqual(Vocation.MASTER_SORCERER, auction.vocation)
self.assertEqual(Sex.MALE, auction.sex)
self.assertEqual(BidType.WINNING, auction.bid_type)
self.assertIsNotNone(auction.character_url)
self.assertEqual(2, len(auction.displayed_items))
self.assertEqual(128, auction.outfit.outfit_id)
self.assertEqual(1, len(auction.displayed_items))
self.assertEqual(143, auction.outfit.outfit_id)

first_item = auction.displayed_items[0]
self.assertEqual(391, first_item.count)
self.assertEqual(268, first_item.item_id)
self.assertEqual("mana potion", first_item.name)
self.assertEqual(1, first_item.count)
self.assertEqual(25700, first_item.item_id)
self.assertEqual("dream blossom staff", first_item.name)
self.assertIsNotNone(first_item.image_url)

self.assertIsNone(bazaar.filters)
Expand Down Expand Up @@ -161,8 +161,8 @@ def test_auction_details_from_content_finished(self):
self.assertIsInstance(auction.creation_date, datetime.datetime)
self.assertEqual(26006721711, auction.experience)
self.assertEqual(41893, auction.gold)
self.assertEqual(540, auction.achievement_points)
self.assertIsInstance(auction.regular_world_transfer_available_date, datetime.datetime)
self.assertEqual(553, auction.achievement_points)
self.assertIsNone(auction.regular_world_transfer_available_date)
self.assertEqual(110, auction.available_charm_points)
self.assertEqual(5800, auction.spent_charm_points)

Expand Down Expand Up @@ -222,12 +222,20 @@ def test_auction_details_from_content_finished(self):
self.assertEqual('Retro Warrior', auction.store_outfits.get_by_id(962).name)
self.assertEqual(2, len(auction.store_outfits.search('retro')))

self.assertIsNotNone(auction.familiars)
self.assertEqual(1, len(auction.familiars.entries))
self.assertEqual(1, auction.familiars.total_pages)
self.assertEqual(1, auction.familiars.results)
self.assertEqual(992, auction.familiars.get_by_name("emberwing").familiar_id)
self.assertEqual('Emberwing', auction.familiars.get_by_id(992).name)
self.assertEqual(1, len(auction.familiars.search('ember')))

self.assertEqual(9, len(auction.blessings))
self.assertEqual(18, len(auction.imbuements))
self.assertEqual(8, len(auction.charms))
self.assertEqual(0, len(auction.completed_cyclopedia_map_areas))
self.assertEqual(16, len(auction.titles))
self.assertEqual(214, len(auction.achievements))
self.assertEqual(217, len(auction.achievements))
self.assertEqual(509, len(auction.bestiary_progress))
self.assertEqual(205, len(auction.completed_bestiary_entries))

Expand Down
2 changes: 1 addition & 1 deletion tibiapy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '3.6.5'
__version__ = '3.7.0'
__author__ = 'Allan Galarza'

import logging
Expand Down
Loading

0 comments on commit 29b4b44

Please sign in to comment.