File tree 1 file changed +28
-0
lines changed 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 3
3
import typing
4
4
import unittest
5
5
import warnings
6
+ from test import support
6
7
7
8
8
9
def global_function ():
@@ -478,6 +479,33 @@ def test_builtin__qualname__(self):
478
479
self .assertEqual ([1 , 2 , 3 ].append .__qualname__ , 'list.append' )
479
480
self .assertEqual ({'foo' : 'bar' }.pop .__qualname__ , 'dict.pop' )
480
481
482
+ @support .cpython_only
483
+ def test_builtin__self__ (self ):
484
+ # See https://github.com/python/cpython/issues/58211.
485
+ import builtins
486
+ import time
487
+
488
+ # builtin function:
489
+ self .assertIs (len .__self__ , builtins )
490
+ self .assertIs (time .sleep .__self__ , time )
491
+
492
+ # builtin classmethod:
493
+ self .assertIs (dict .fromkeys .__self__ , dict )
494
+ self .assertIs (float .__getformat__ .__self__ , float )
495
+
496
+ # builtin staticmethod:
497
+ self .assertIsNone (str .maketrans .__self__ )
498
+ self .assertIsNone (bytes .maketrans .__self__ )
499
+
500
+ # builtin bound instance method:
501
+ l = [1 , 2 , 3 ]
502
+ self .assertIs (l .append .__self__ , l )
503
+
504
+ d = {'foo' : 'bar' }
505
+ self .assertEqual (d .pop .__self__ , d )
506
+
507
+ self .assertIsNone (None .__repr__ .__self__ )
508
+
481
509
482
510
if __name__ == "__main__" :
483
511
unittest .main ()
You can’t perform that action at this time.
0 commit comments