We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b04946 commit caaff8dCopy full SHA for caaff8d
1 file changed
Lib/test/test_descr.py
@@ -241,6 +241,29 @@ def Amethod(self): pass
241
a.amethod = lambda self: 3
242
verify(interesting(dir(a)) == astuff + ['adata', 'amethod'])
243
244
+ # Try a module subclass.
245
+ import sys
246
+ class M(type(sys)):
247
+ pass
248
+ minstance = M()
249
+ minstance.b = 2
250
+ minstance.a = 1
251
+ verify(dir(minstance) == ['a', 'b'])
252
+
253
+ class M2(M):
254
+ def getdict(self):
255
+ return "Not a dict!"
256
+ __dict__ = property(getdict)
257
258
+ m2instance = M2()
259
+ m2instance.b = 2
260
+ m2instance.a = 1
261
+ verify(m2instance.__dict__ == "Not a dict!")
262
+ try:
263
+ dir(m2instance)
264
+ except TypeError:
265
266
267
binops = {
268
'add': '+',
269
'sub': '-',
0 commit comments