You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 3.3.2.4. __slots__ // We are not testing the suppression of -weakref_ and _dict_ here
306
306
# object.__slots__
307
307
# __weakref__
308
308
# __dict__
309
309
310
310
# 3.3.3. Customizing class creation
311
311
# classmethod object.__init_subclass__(cls)
312
+
classWith_init_subclass:
313
+
314
+
def__init_subclass__(cls):
315
+
OK()
316
+
317
+
deftest_init_subclass():
318
+
type("Subclass", (With_init_subclass,), {})
312
319
313
320
# 3.3.3.1. Metaclasses
314
321
# By default, classes are constructed using type(). The class body is executed in a new namespace and the class name is bound locally to the result of type(name, bases, namespace).
@@ -318,13 +325,52 @@ def test_set_name():
318
325
319
326
# 3.3.3.4. Preparing the class namespace
320
327
# metaclass.__prepare__(name, bases, **kwds)
328
+
classWith_prepare(type):
329
+
330
+
def__prepare__(name, bases, **kwds):
331
+
OK()
332
+
returnkwds
333
+
334
+
335
+
deftest_prepare():
336
+
classWith_meta(metaclass=With_prepare):
337
+
pass
321
338
322
339
# 3.3.4. Customizing instance and subclass checks
323
340
# class.__instancecheck__(self, instance)
341
+
classWith_instancecheck:
342
+
343
+
def__instancecheck__(self, instance):
344
+
OK()
345
+
returnTrue
346
+
347
+
deftest_instancecheck():
348
+
with_instancecheck=With_instancecheck()
349
+
isinstance("", with_instancecheck)
350
+
324
351
# class.__subclasscheck__(self, subclass)
352
+
classWith_subclasscheck:
353
+
354
+
def__subclasscheck__(self, subclass):
355
+
OK()
356
+
returnTrue
357
+
358
+
deftest_subclasscheck():
359
+
with_subclasscheck=With_subclasscheck()
360
+
issubclass(object, with_subclasscheck)
361
+
325
362
326
363
# 3.3.5. Emulating generic types
327
364
# classmethod object.__class_getitem__(cls, key)
365
+
classWith_class_getitem:
366
+
367
+
def__class_getitem__(cls, key):
368
+
OK()
369
+
returnobject
370
+
371
+
deftest_class_getitem():
372
+
with_class_getitem=With_class_getitem[int]()
373
+
328
374
329
375
# 3.3.6. Emulating callable objects
330
376
# object.__call__(self[, args...])
@@ -1113,7 +1159,7 @@ async def atest_await():
1113
1159
await(with_await)
1114
1160
1115
1161
1116
-
# # 3.4.2. Coroutine Objects
1162
+
# # 3.4.2. Coroutine Objects // These should be handled as normal function calls
0 commit comments