Skip to content

Commit

Permalink
Merge pull request #33 from jcchristian/master
Browse files Browse the repository at this point in the history
Added id32 property and unittest
  • Loading branch information
Lagg committed Oct 14, 2014
2 parents 248ce5b + 2854274 commit 0107604
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions steam/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def id64(self):
""" Returns the 64 bit steam ID (use with other API requests) """
return int(self._prof["steamid"])

@property
def id32(self):
""" Returns the 32 bit steam ID """
return int(self.id64) - 76561197960265728

@property
def persona(self):
""" Returns the user's persona (what you usually see in-game) """
Expand Down
2 changes: 2 additions & 0 deletions tests/testuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class ProfileTestCase(unittest.TestCase):
VALID_ID64 = 76561198014028523
VALID_ID32 = 53762795
INVALID_ID64 = 123
# This is weird but there should be no reason that it's invalid.
# So Valve, if you see this, be gewd guys and make 33 bit (condensed)
Expand Down Expand Up @@ -39,6 +40,7 @@ def test_pathed_id(self):
def test_valid_id(self):
profile = user.profile(self.VALID_ID64)
self.assertEqual(profile.id64, self.VALID_ID64)
self.assertEqual(profile.id32, self.VALID_ID32)

def test_weird_id(self):
profile = user.profile(self.WEIRD_ID64)
Expand Down

0 comments on commit 0107604

Please sign in to comment.