diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-15 19:35:30 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-01-15 19:35:39 +0100 |
| commit | be0b8968651f98b962a18c4e750d6396c0fdaf47 (patch) | |
| tree | 5d577ecb713068cc91feeb3f1c22ae134dbf236a /tests | |
| parent | 517ac9c3f5b342327ddb248436fc7b47ce54b885 (diff) | |
| download | python-gamelocker-be0b8968651f98b962a18c4e750d6396c0fdaf47.tar.gz python-gamelocker-be0b8968651f98b962a18c4e750d6396c0fdaf47.zip | |
add functions to fancify items
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gamelocker_test.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/gamelocker_test.py b/tests/gamelocker_test.py index d9f967d..373269a 100644 --- a/tests/gamelocker_test.py +++ b/tests/gamelocker_test.py @@ -22,6 +22,30 @@ class TestGamelocker: def test_map(self): assert gamelocker.datatypes.modulemap()["match"] is gamelocker.datatypes.Match + def test_strings(self, api): + stats = gamelocker.strings.Stats({"foo": 1, "bar": 2, "baz": {"deep": True}}) + assert stats.foo == 1 + assert stats.baz.deep == True + + taka = gamelocker.strings.Hero("*Sayoc*") + assert taka == "*Sayoc*" + assert taka.pretty() == "Taka" + assert gamelocker.strings.Hero("notexisting") == "notexisting" + + assert gamelocker.strings.Item("Boots2").pretty() == "Travel Boots" + assert gamelocker.strings.Item("*1032_Item_TravelBoots*").pretty() == "Travel Boots" + assert gamelocker.strings.Item("unknowntestitem").pretty() == "unknowntestitem" + + assert gamelocker.strings.LazyObject("Boots2").pretty() == "Travel Boots" + assert gamelocker.strings.LazyObject("*Sayoc*").pretty() == "Taka" + + match = api.match("91cf2ee4-d7d0-11e6-ad79-062445d3d668") + assert isinstance(match.rosters[0].participants[0].actor, gamelocker.strings.Hero) + + assert isinstance(match.rosters[0].stats.acesEarned, int) + assert isinstance(match.rosters[0].participants[0].stats.items[0], gamelocker.strings.LazyObject) + assert isinstance(match.rosters[0].participants[0].stats.items[0].pretty(), str) + def test_match(self, api): match = api.match("91cf2ee4-d7d0-11e6-ad79-062445d3d668") assert match.gameMode == "casual" @@ -37,7 +61,18 @@ class TestGamelocker: assert matches[0].duration > 0 def test_matchesfilters(self, api): - assert len(api.matches(limit=5)) == 5 + matches1 = api.matches(limit=3) + assert len(matches1) == 3 + matches2 = api.matches(limit=3, offset=1) + + commons = 0 # 3 matches each, offset 1 -> 2 overlap + for match1 in matches1: + for match2 in matches2: + if match1.id == match2.id: + commons += 1 + assert commons == 2 + + assert len(api.matches(limit=52)) == 52 # TODO uncomment as soon as the API is up # matches = api.matches(limit=10, sort="duration") |
