File tree 1 file changed +20
-5
lines changed
1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,26 @@ def test_attr_matches(self):
54
54
['str.{}(' .format (x ) for x in dir (str )
55
55
if x .startswith ('s' )])
56
56
self .assertEqual (self .stdcompleter .attr_matches ('tuple.foospamegg' ), [])
57
- expected = sorted ({'None.%s%s' % (x ,
58
- '()' if x in ('__init_subclass__' , '__class__' )
59
- else '' if x == '__doc__'
60
- else '(' )
61
- for x in dir (None )})
57
+
58
+ def create_expected_for_none ():
59
+ if not MISSING_C_DOCSTRINGS :
60
+ parentheses = ('__init_subclass__' , '__class__' )
61
+ else :
62
+ # When `--without-doc-strings` is used, `__class__`
63
+ # won't have a known signature.
64
+ parentheses = ('__init_subclass__' ,)
65
+
66
+ items = set ()
67
+ for x in dir (None ):
68
+ if x in parentheses :
69
+ items .add (f'None.{ x } ()' )
70
+ elif x == '__doc__' :
71
+ items .add (f'None.{ x } ' )
72
+ else :
73
+ items .add (f'None.{ x } (' )
74
+ return sorted (items )
75
+
76
+ expected = create_expected_for_none ()
62
77
self .assertEqual (self .stdcompleter .attr_matches ('None.' ), expected )
63
78
self .assertEqual (self .stdcompleter .attr_matches ('None._' ), expected )
64
79
self .assertEqual (self .stdcompleter .attr_matches ('None.__' ), expected )
You can’t perform that action at this time.
0 commit comments