Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #313

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ jobs:

- name: Pytest
shell: powershell
run: pytest . -m "not requests and not selenium" -v

- name: Pytest requests
shell: powershell
run: pytest . -m "requests" -v -n auto
run: pytest . -m "not selenium" -v -n logical

# - name: Pytest selenium
# shell: powershell
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.6.0beta6"
__version__ = "5.6.0beta7"
6 changes: 4 additions & 2 deletions src/gui/importer/maxroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def _find_item_affixes(mapping_data: dict, item_affixes: dict) -> list[Affix]:
if affix["id"] != affix_id["nid"]:
continue
attr_desc = ""
if "formula" in affix["attributes"][0] and affix["attributes"][0]["formula"] in [
if affix["id"] == 1014505:
attr_desc = "evade grants movement speed for second"
elif "formula" in affix["attributes"][0] and affix["attributes"][0]["formula"] in [
"AffixFlatResourceUpto4",
"AffixResourceOnKill",
"AffixSingleResist",
Expand Down Expand Up @@ -198,7 +200,7 @@ def _extract_planner_url_and_id_from_guide(url: str) -> tuple[str, int]:
src.logger.setup()
os.chdir(pathlib.Path(__file__).parent.parent.parent.parent)
URLS = [
"https://maxroll.gg/d4/planner/f5awh02y#1",
"https://maxroll.gg/d4/planner/p6c50vom",
]
for X in URLS:
import_maxroll(url=X)
6 changes: 3 additions & 3 deletions src/item/descr/read_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def read_descr(rarity: ItemRarity, img_item_descr: np.ndarray, show_warnings: bo

# Find item type and item power / tier list
# =========================
item, item_type_str = read_item_type(base_item, img_item_descr, sep_short_match)
# In case it was not successful, try without doing image pre-processing
item, item_type_str = read_item_type(base_item, img_item_descr, sep_short_match, do_pre_proc=False)
# In case it was not successful, try with doing image pre-processing
if item is None:
item, item_type_str = read_item_type(base_item, img_item_descr, sep_short_match, do_pre_proc=False)
item, item_type_str = read_item_type(base_item, img_item_descr, sep_short_match)
if item is None:
if show_warnings:
LOGGER.warning(f"Could not detect ItemPower and ItemType: {item_type_str}")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 0 additions & 15 deletions tests/item/filter/data/aspects.py

This file was deleted.

27 changes: 1 addition & 26 deletions tests/item/filter/filter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from pytest_mock import MockerFixture

import tests.item.filter.data.filters as filters
from src.config.models import AspectFilterType, SigilPriority
from src.config.models import SigilPriority
from src.item.filter import Filter, _FilterResult
from src.item.models import Item
from tests.item.filter.data.affixes import affixes
from tests.item.filter.data.aspects import aspects
from tests.item.filter.data.sigils import sigil_jalal, sigil_priority, sigils
from tests.item.filter.data.uniques import uniques

Expand All @@ -27,30 +26,6 @@ def test_affixes(name: str, result: list[str], item: Item, mocker: MockerFixture
assert natsorted([match.profile for match in test_filter.should_keep(item).matched]) == natsorted(result)


@pytest.mark.parametrize(("name", "result", "item"), natsorted(aspects), ids=[name for name, _, _ in natsorted(aspects)])
def test_aspects_all(name: str, result: list[str], item: Item, mocker: MockerFixture, mock_ini_loader: MockerFixture):
test_filter = _create_mocked_filter(mocker)
mock_ini_loader._general.keep_aspects = AspectFilterType.all
filter_res = test_filter.should_keep(item).matched
assert len(filter_res) == 1 if AspectFilterType.all in result else len(filter_res) == 0


@pytest.mark.parametrize(("name", "result", "item"), natsorted(aspects), ids=[name for name, _, _ in natsorted(aspects)])
def test_aspects_none(name: str, result: list[str], item: Item, mocker: MockerFixture, mock_ini_loader: MockerFixture):
test_filter = _create_mocked_filter(mocker)
mock_ini_loader._general.keep_aspects = AspectFilterType.none
filter_res = test_filter.should_keep(item).matched
assert len(filter_res) == 0


@pytest.mark.parametrize(("name", "result", "item"), natsorted(aspects), ids=[name for name, _, _ in natsorted(aspects)])
def test_aspects_upgrade(name: str, result: list[str], item: Item, mocker: MockerFixture, mock_ini_loader: MockerFixture):
test_filter = _create_mocked_filter(mocker)
mock_ini_loader._general.keep_aspects = AspectFilterType.upgrade
filter_res = test_filter.should_keep(item).matched
assert len(filter_res) == 1 if AspectFilterType.upgrade in result else len(filter_res) == 0


@pytest.mark.parametrize(("name", "result", "item"), natsorted(sigils), ids=[name for name, _, _ in natsorted(sigils)])
def test_sigils(name: str, result: list[str], item: Item, mocker: MockerFixture):
test_filter = _create_mocked_filter(mocker)
Expand Down
30 changes: 30 additions & 0 deletions tests/item/read_descr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,36 @@
rarity=ItemRarity.Legendary,
),
),
(
(1920, 1080),
f"{BASE_PATH}/read_descr_legendary_1080p_7.png",
Item(
affixes=[
Affix(name="maximum_life", value=1591),
Affix(name="energy_on_kill", value=4),
Affix(name="critical_strike_damage", value=150, type=AffixType.greater),
],
inherent=[Affix(name="vulnerable_damage", value=32, type=AffixType.inherent)],
item_type=ItemType.Crossbow2H,
power=925,
rarity=ItemRarity.Legendary,
),
),
(
(1920, 1080),
f"{BASE_PATH}/read_descr_legendary_1080p_8.png",
Item(
affixes=[
Affix(name="maximum_life", value=1591),
Affix(name="energy_on_kill", value=4),
Affix(name="critical_strike_damage", value=150, type=AffixType.greater),
],
inherent=[Affix(name="vulnerable_damage", value=32, type=AffixType.inherent)],
item_type=ItemType.Crossbow2H,
power=925,
rarity=ItemRarity.Legendary,
),
),
(
(2560, 1440),
f"{BASE_PATH}/read_descr_legendary_1440p.png",
Expand Down