diff --git a/conftest.py b/conftest.py index a981554..f98fddc 100644 --- a/conftest.py +++ b/conftest.py @@ -26,6 +26,7 @@ def get_item_data(file_name: str) -> dict: SPELLED_ITEM = get_item_data("spelled_item") PAINTED_HAT = get_item_data("painted_hat") ELLIS_CAP = get_item_data("ellis_cap") +STRANGE_PART = get_item_data("strange_part") @pytest.fixture @@ -84,6 +85,11 @@ def ellis_cap() -> dict: return ELLIS_CAP +@pytest.fixture +def strange_part() -> dict: + return STRANGE_PART + + @pytest.fixture async def aiohttp_session(): async with ClientSession() as session: diff --git a/src/tf2_utils/__init__.py b/src/tf2_utils/__init__.py index 2f222f4..7489104 100644 --- a/src/tf2_utils/__init__.py +++ b/src/tf2_utils/__init__.py @@ -1,7 +1,7 @@ # flake8: noqa: F401, F403 __title__ = "tf2-utils" __author__ = "offish" -__version__ = "2.4.1" +__version__ = "2.4.2" __license__ = "MIT" from .currency import CurrencyExchange diff --git a/src/tf2_utils/item.py b/src/tf2_utils/item.py index b517b0b..8b2e35f 100644 --- a/src/tf2_utils/item.py +++ b/src/tf2_utils/item.py @@ -64,7 +64,7 @@ def has_quality(self, quality: str) -> bool: return self.get_quality() == quality def has_strange_in_name(self) -> bool: - return "Strange" in self.name + return "Strange " in self.name and "Strange Part: " not in self.name def has_vintage_in_name(self) -> bool: return "Vintage" in self.name diff --git a/tests/test_sku.py b/tests/test_sku.py index b238ff2..3ce218c 100644 --- a/tests/test_sku.py +++ b/tests/test_sku.py @@ -27,11 +27,25 @@ def test_ellis_cap_sku_properties(ellis_cap: dict) -> None: } +def test_strange_part_sku_properties(strange_part: dict) -> None: + assert get_sku_properties(strange_part) == { + "defindex": 6012, + "quality": 6, + "australium": False, + "craftable": True, + "wear": -1, + "killstreak_tier": -1, + "festivized": False, + "strange": False, + } + + def test_get_sku_items( ellis_cap: dict, crusaders_crossbow: dict, hong_kong_cone: dict, uncraftable_hat: dict, + strange_part: dict, ) -> None: # https://marketplace.tf/items/tf2/263;6 assert get_sku(ellis_cap) == "263;6" @@ -41,6 +55,8 @@ def test_get_sku_items( assert get_sku(hong_kong_cone) == "30177;5;u107;strange" # https://marketplace.tf/items/tf2/734;6;uncraftable assert get_sku(uncraftable_hat) == "734;6;uncraftable" + # https://marketplace.tf/items/tf2/6012;6 + assert get_sku(strange_part) == "6012;6" def test_properties() -> None: