Example #1
0
 def test_item_repr(self):
     item_repr = repr(entities.Item(3))
     item_match_str = "Item(item_id = 3)"
     self.assertEqual(
         item_repr, item_match_str,
         "repr(entities.Item(3)) should be {0}".format(item_match_str))
Example #2
0
from d2api.src import entities

# Hero/Item/Ability information is available without having to specify a key
print(entities.Hero(67)['hero_name'])
print(entities.Item(208)['item_aliases'])
print(entities.Ability(6697)['ability_name'])

# Use steam32/steam64 IDs interchangeably
steam_account = entities.SteamAccount(1020002)
print(steam_account['id32'], steam_account['id64'])
Example #3
0
 def test_item_bool(self):
     item1 = entities.Item(None)
     item2 = entities.Item(2)
     self.assertTrue(not item1, "not {0} should be True".format(item1))
     self.assertFalse(not item2, "not {0} should be False".format(item2))