-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from offish/v2.0.5
fix circular import and add more stuff
- Loading branch information
Showing
5 changed files
with
137 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
__title__ = "tf2-utils" | ||
__author__ = "offish" | ||
__version__ = "2.0.3" | ||
__version__ = "2.0.5" | ||
__license__ = "MIT" | ||
|
||
from .schema import SchemaItems, IEconItems | ||
from .inventory import Inventory, map_inventory | ||
from .sku import get_sku, get_sku_properties | ||
from .sku import get_sku, get_sku_properties, sku_to_defindex | ||
from .item import Item | ||
from .offer import Offer | ||
from .utils import to_refined, to_scrap, refinedify, account_id_to_steam_id | ||
from .schema import SchemaItemsUtils | ||
from .sockets import BackpackTFSocket, PricesTFSocket | ||
from .prices_tf import PricesTF | ||
from .item import Item | ||
from .offer import Offer | ||
from .inventory import Inventory, map_inventory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from src.tf2_utils import SchemaItemsUtils | ||
|
||
from unittest import TestCase | ||
|
||
|
||
schema_items = SchemaItemsUtils() # uses local files by default | ||
|
||
|
||
class TestUtils(TestCase): | ||
def test_map_defindex_names(self): | ||
response = schema_items.map_defindex_name() | ||
self.assertNotEqual({}, response) | ||
|
||
def test_name_to_sku_tod(self): | ||
sku = schema_items.name_to_sku("Uncraftable Tour of Duty Ticket") | ||
self.assertEqual("725;6;uncraftable", sku) | ||
|
||
def test_name_to_sku_key(self): | ||
sku = schema_items.name_to_sku("Mann Co. Supply Crate Key") | ||
self.assertEqual("5021;6", sku) | ||
|
||
def test_name_to_sku_name_tag(self): | ||
sku = schema_items.name_to_sku("Name Tag") | ||
self.assertEqual("5020;6", sku) | ||
|
||
def test_name_to_sku_pure(self): | ||
ref = schema_items.name_to_sku("Refined Metal") | ||
rec = schema_items.name_to_sku("Reclaimed Metal") | ||
scrap = schema_items.name_to_sku("Scrap Metal") | ||
|
||
self.assertEqual("5002;6", ref) | ||
self.assertEqual("5001;6", rec) | ||
self.assertEqual("5000;6", scrap) | ||
|
||
def test_name_to_sku_non_existing(self): | ||
# this item does not exist | ||
item_name = "Non-Craftable Strange Team Captain" | ||
sku = schema_items.name_to_sku(item_name) | ||
defindex = schema_items.name_to_defindex(item_name) | ||
|
||
self.assertEqual("378;11;uncraftable", sku) | ||
self.assertEqual(-1, defindex) | ||
|
||
def test_name_to_sku_qualities(self): | ||
unique = schema_items.name_to_sku("Team Captain") | ||
genuine = schema_items.name_to_sku("Genuine Team Captain") | ||
haunted = schema_items.name_to_sku("Haunted Team Captain") | ||
strange = schema_items.name_to_sku("Strange Team Captain") | ||
vintage = schema_items.name_to_sku("Vintage Team Captain") | ||
collectors = schema_items.name_to_sku("Collector's Team Captain") | ||
|
||
self.assertEqual("378;1", genuine) | ||
self.assertEqual("378;3", vintage) | ||
self.assertEqual("378;6", unique) | ||
self.assertEqual("378;11", strange) | ||
self.assertEqual("378;13", haunted) | ||
self.assertEqual("378;14", collectors) | ||
|
||
def test_sku_to_name_tod(self): | ||
name = schema_items.sku_to_name("725;6;uncraftable") | ||
self.assertEqual("Tour of Duty Ticket", name) | ||
|
||
def test_sku_to_name_key(self): | ||
name = schema_items.sku_to_name("5021;6") | ||
self.assertEqual("Mann Co. Supply Crate Key", name) | ||
|
||
def test_image_equal(self): | ||
ellis_cap = schema_items.defindex_to_image_url(263) | ||
random_craft_hat = schema_items.sku_to_image_url("-100;6") | ||
self.assertEqual(ellis_cap, random_craft_hat) |