diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa3baefd..7cfc8b8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/src/__init__.py b/src/__init__.py index b94a91d6..1f7d2875 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1 +1 @@ -__version__ = "5.6.0beta6" +__version__ = "5.6.0beta7" diff --git a/src/gui/importer/maxroll.py b/src/gui/importer/maxroll.py index 510d1792..5db29686 100644 --- a/src/gui/importer/maxroll.py +++ b/src/gui/importer/maxroll.py @@ -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", @@ -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) diff --git a/src/item/descr/read_descr.py b/src/item/descr/read_descr.py index bea3f2fd..ed914233 100644 --- a/src/item/descr/read_descr.py +++ b/src/item/descr/read_descr.py @@ -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}") diff --git a/tests/assets/item/read_descr_legendary_1080p_7.png b/tests/assets/item/read_descr_legendary_1080p_7.png new file mode 100644 index 00000000..fc391538 Binary files /dev/null and b/tests/assets/item/read_descr_legendary_1080p_7.png differ diff --git a/tests/assets/item/read_descr_legendary_1080p_8.png b/tests/assets/item/read_descr_legendary_1080p_8.png new file mode 100644 index 00000000..20591e77 Binary files /dev/null and b/tests/assets/item/read_descr_legendary_1080p_8.png differ diff --git a/tests/item/filter/data/aspects.py b/tests/item/filter/data/aspects.py deleted file mode 100644 index f94b0416..00000000 --- a/tests/item/filter/data/aspects.py +++ /dev/null @@ -1,15 +0,0 @@ -from src.item.data.aspect import Aspect -from src.item.data.item_type import ItemType -from src.item.data.rarity import ItemRarity -from src.item.models import Item - - -class TestLegendary(Item): - def __init__(self, codex_upgrade=False, **kwargs): - super().__init__(rarity=ItemRarity.Legendary, item_type=ItemType.Shield, power=910, codex_upgrade=codex_upgrade, **kwargs) - - -aspects = [ - ("upgrade", ["all", "upgrade"], TestLegendary(aspect=Aspect(name="of_anemia", value=30), codex_upgrade=True)), - ("no upgrade", ["all"], TestLegendary(aspect=Aspect(name="of_anemia", value=30))), -] diff --git a/tests/item/filter/filter_test.py b/tests/item/filter/filter_test.py index 09853031..6391e679 100644 --- a/tests/item/filter/filter_test.py +++ b/tests/item/filter/filter_test.py @@ -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 @@ -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) diff --git a/tests/item/read_descr_test.py b/tests/item/read_descr_test.py index e6bf6d4d..325da61e 100644 --- a/tests/item/read_descr_test.py +++ b/tests/item/read_descr_test.py @@ -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",