8000 Add equality testing to Keys too. · dahlia/github3.py@8232935 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8232935

Browse files
committed
Add equality testing to Keys too.
1 parent 2bcb833 commit 8232935

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

github3/gists/gist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class Gist(GitHubCore):
2121
you own it). You can also "star" or "unstar" the gist (again assuming you
2222
have authenticated).
2323
"""
24-
2524
def __init__(self, data, session=None):
2625
super(Gist, self).__init__(data, session)
2726
#: Number of comments on this gist

github3/users.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def __repr__(self):
3131
def __str__(self):
3232
return self.key
3333

34+
def __eq__(self, other):
35+
return self.id == other.id
36+
3437
def _update_(self, key):
3538
self.__init__(key, self._session)
3639

tests/test_users.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def setUp(self):
1414
super(TestKey, self).setUp()
1515
self.key = github3.users.Key(self.key.to_json(), self.g)
1616

17+
def test_equality(self):
18+
expect(self.key) == github3.users.Key(self.key.to_json())
19+
1720
def test_str(self):
1821
expect(str(self.key)) == self.key.key
1922
expect(repr(self.key).startswith('<User Key')).is_True()

0 commit comments

Comments
 (0)
0