8000 Merge remote-tracking branch 'github/pr/76' into develop · davidmoss/github3.py@2bcb833 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2bcb833

Browse files
committed
Merge remote-tracking branch 'github/pr/76' into develop
2 parents b0ea060 + 6931da0 commit 2bcb833

File tree

9 files changed

+27
-0
lines changed

9 files changed

+27
-0
lines changed

github3/gists/gist.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def __init__(self, data, session=None):
7070
#: History of this gist, list of :class:`GistHistory <GistHistory>`
7171
self.history = [GistHistory(h, self) for h in data.get('history', [])]
7272

73+
def __eq__(self, gist):
74+
return self.id == gist.id
75+
7376
def __str__(self):
7477
return self.id
7578

github3/issues/issue.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def __init__(self, issue, session=None):
6666
#: :class:`User <github3.users.User>` who opened the issue.
6767
self.user = User(issue.get('user'), self._session)
6868

69+
def __eq__(self, issue):
70+
return self.id == issue.id
71+
6972
def __repr__(self):
7073
return '<Issue [{r[0]}/{r[1]} #{n}]>'.format(r=self.repository,
7174
n=self.number)

github3/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ def __init__(self, acct, session):
346346
#: Markdown formatted biography
347347
self.bio = acct.get('bio')
348348

349+
def __eq__(self, acc):
350+
return self.id == acc.id
351+
349352
def __repr__(self):
350353
return '<{s.type} [{s.login}:{s.name}]>'.format(s=self)
351354

github3/repos/repo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def __init__(self, repo, session=None):
128128
#: default branch for the repository
129129
self.master_branch = repo.get('master_branch', '')
130130

131+
def __eq__(self, repo):
132+
return self.id == repo.id
133+
131134
def __repr__(self):
132135
return '<Repository [{0}]>'.format(self)
133136

tests/test_gists.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ def test_history(self):
165165

166166
expect(repr(hist).startswith('<Gist History')).is_True()
167167

168+
def test_equality(self):
169+
expect(self.gist) == gists.Gist(load('gist'))
170+
168171

169172
class TestGistComment(BaseCase):
170173
def __init__(self, methodName='runTest'):

tests/test_issues.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,6 @@ def test_reopen(self):
302302
ed.assert_called_once_with(
303303
self.i.title, self.i.body, u, 'open', n, self.i.labels
304304
)
305+
306+
def test_equality(self):
307+
expect(self.i) == github3.issues.Issue(load('issue'))

tests/test_orgs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,6 @@ def test_team(self):
373373

374374
expect(self.org.team(1)).isinstance(github3.orgs.Team)
375375
self.mock_assertions()
376+
377+
def test_equality(self):
378+
expect(self.org) == github3.orgs.Organization(load('org'))

tests/test_repos.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,9 @@ def test_update_label(self):
996996

997997
self.mock_assertions()
998998

999+
def test_equality(self):
1000+
expect(self.repo) == repos.Repository(load('repo'))
1001+
9991002

10001003
class TestContents(BaseCase):
10011004
def __init__(self, methodName='runTest'):

tests/test_users.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,6 @@ def test_update(self):
269269

270270
self.response('', 404)
271271
expect(self.user.update(**self.conf['data'])).is_False()
272+
273+
def test_equality(self):
274+
expect(self.user) == github3.users.User(load('user'))

0 commit comments

Comments
 (0)
0