File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,16 @@ def __repr__(self):
99
99
def __eq__ (self , other ):
100
100
if self .get_id () and other .get_id ():
101
101
return self .get_id () == other .get_id ()
102
- return super ().__eq__ (other )
102
+ return super (RESTObject , self ) == other
103
+
104
+ def __ne__ (self , other ):
105
+ if self .get_id () and other .get_id ():
106
+ return self .get_id () != other .get_id ()
107
+ return super (RESTObject , self ) != other
103
108
104
109
def __hash__ (self ):
105
110
if not self .get_id ():
106
- return super ().__hash__ ()
111
+ return super (RESTObject , self ).__hash__ ()
107
112
return hash (self .get_id ())
108
113
109
114
def _create_managers (self ):
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ class ObjectWithManager(FakeObject):
131
131
_managers = (('fakes' , 'FakeManager' ), )
132
132
133
133
obj = ObjectWithManager (self .manager , {'foo' : 'bar' })
134
+ obj .id = 42
134
135
self .assertIsInstance (obj .fakes , FakeManager )
135
136
self .assertEqual (obj .fakes .gitlab , self .gitlab )
136
137
self .assertEqual (obj .fakes ._parent , obj )
@@ -145,7 +146,10 @@ class OtherFakeObject(FakeObject):
145
146
_id_attr = 'foo'
146
147
147
148
obj1 = OtherFakeObject (self .manager , {'foo' : 'bar' })
148
- obj2 = OtherFakeObject (self .manager , {'foo' : 'bar' , 'other_attr' : 'baz' })
149
+ obj2 = OtherFakeObject (
150
+ self .manager ,
151
+ {'foo' : 'bar' , 'other_attr' : 'baz' }
152
+ )
149
153
self .assertEqual (obj1 , obj2 )
150
154
151
155
def test_inequality (self ):
You can’t perform that action at this time.
0 commit comments