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):
9999 def __eq__ (self , other ):
100100 if self .get_id () and other .get_id ():
101101 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
103108
104109 def __hash__ (self ):
105110 if not self .get_id ():
106- return super ().__hash__ ()
111+ return super (RESTObject , self ).__hash__ ()
107112 return hash (self .get_id ())
108113
109114 def _create_managers (self ):
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ class ObjectWithManager(FakeObject):
131131 _managers = (('fakes' , 'FakeManager' ), )
132132
133133 obj = ObjectWithManager (self .manager , {'foo' : 'bar' })
134+ obj .id = 42
134135 self .assertIsInstance (obj .fakes , FakeManager )
135136 self .assertEqual (obj .fakes .gitlab , self .gitlab )
136137 self .assertEqual (obj .fakes ._parent , obj )
@@ -145,7 +146,10 @@ class OtherFakeObject(FakeObject):
145146 _id_attr = 'foo'
146147
147148 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+ )
149153 self .assertEqual (obj1 , obj2 )
150154
151155 def test_inequality (self ):
You can’t perform that action at this time.
0 commit comments