@@ -215,13 +215,42 @@ def method(self, x):
215
215
pass
216
216
217
217
218
+ class OldStyleFoo :
219
+ a = 10
220
+
221
+ def __init__ (self ):
222
+ self .b = 20
223
+
224
+ def method (self , x ):
225
+ pass
226
+
227
+
228
+ skip_old_style = unittest .skipIf (py3 ,
229
+ 'In Python 3 there are no old style classes' )
230
+
231
+
218
232
class TestAttrCompletion (unittest .TestCase ):
233
+ @classmethod
234
+ def setUpClass (cls ):
235
+ cls .com = autocomplete .AttrCompletion ()
219
236
220
237
def test_att_matches_found_on_instance (self ):
221
- com = autocomplete .AttrCompletion ()
222
- self .assertSetEqual (com .matches (2 , 'a.' , locals_ = {'a' : Foo ()}),
238
+ self .assertSetEqual (self .com .matches (2 , 'a.' , locals_ = {'a' : Foo ()}),
223
239
set (['a.method' , 'a.a' , 'a.b' ]))
224
240
241
+ @skip_old_style
242
+ def test_att_matches_found_on_old_style_instance (self ):
243
+ self .assertSetEqual (self .com .matches (2 , 'a.' ,
244
+ locals_ = {'a' : OldStyleFoo ()}),
245
+ {'a.method' , 'a.a' , 'a.b' })
246
+ self .assertIn (u'a.__dict__' ,
247
+ self .com .matches (3 , 'a._' , locals_ = {'a' : OldStyleFoo ()}))
248
+
249
+ @skip_old_style
250
+ def test_att_matches_found_on_old_style_class_object (self ):
251
+ self .assertIn (u'A.__dict__' ,
252
+ self .com .matches (3 , 'A._' , locals_ = {'A' : OldStyleFoo }))
253
+
225
254
226
255
class TestMagicMethodCompletion (unittest .TestCase ):
227
256
0 commit comments