Skip to content

Commit

Permalink
fixed filtering out red item types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisoro committed Jun 19, 2024
1 parent 7ef6c86 commit d0e6faa
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 46 deletions.
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
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

0 comments on commit d0e6faa

Please sign in to comment.