File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 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):
5454 ['str.{}(' .format (x ) for x in dir (str )
5555 if x .startswith ('s' )])
5656 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 ()
6277 self .assertEqual (self .stdcompleter .attr_matches ('None.' ), expected )
6378 self .assertEqual (self .stdcompleter .attr_matches ('None._' ), expected )
6479 self .assertEqual (self .stdcompleter .attr_matches ('None.__' ), expected )
You can’t perform that action at this time.
0 commit comments