B ^&c@sddlmZddlZddlZddlZddlZGdddZeZejZ ej Z Gdddej Z Gdddej Zed krejd d dS) )calltipNc@seZdZdZd!ddZde_ddZde_d"d d Zd e_d d Zde_ddZde_d#ddZ de _ddZ de _ddZ de _ddZ e ddZedd ZdS)$TCz (ai=None, *b)NcGdSNselfaibrr6/usr/lib64/python3.7/idlelib/idle_test/test_calltip.py__init__z TC.__init__z(self, ai=None, *b)cCrrrrrrr t1r zTC.t1(self)cCrrrrrrr t2r zTC.t2z(self, ai, b=None)cGrrr)rrargsrrr t3r zTC.t3z(self, ai, *args)cGrrr)rrrrr t4r zTC.t4z (self, *args)cOrrr)rrr rkwrrr t5r zTC.t5z(self, ai, b=None, *args, **kw)cCrrr)Znorrrr t6r zTC.t6z (no, self)cCrrrrZcirrr __call__r z TC.__call__z (self, ci)cCrrrr rrr ndr zTC.ndcCrrr)Zclsarrr cm zTC.cmcCrrr)r rrr sm"rzTC.smrrr)__name__ __module__ __qualname__tipr rrrrrrrrZ classmethodrZ staticmethodrrrrr r s(    rc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) Get_argspecTestcsfdd}Gdddt}Gddd}|jdk rN||dtjd|j|tjd |tjd tjdd tjd }|tjd |||jd ||gjd||tjd||t t d}|t j d||j ddS)Ncst||dSr) assertEqualget_spec)objZoutr rr tiptest5rz.Get_argspecTest.test_builtins..tiptestc@s eZdZdS)z+Get_argspecTest.test_builtins..ListN)rrr rrrr List9r'c@seZdZdZdS)z)Get_argspecTest.test_builtins..SBNrrr rrrrr SB<r(r*z(iterable=(), /)Z zY(*args, **kwargs) Create and return a new object. See help(type) for accurate signature.z(self, /, *args, **kwargs)z>Initialize self. See help(type(self)) for accurate signature.z& Append object to the end of the list.z(self, object, /)z (object, /)zmethod(function, instance)aO(pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable, it's passed the Match object and must returnzm(repl, string, count=0) Return the string obtained by replacing the leftmost non-overlapping occurrences o...) Zlist__doc__rZ_argument_positionalZ__new__r ZappendtypesZ MethodType default_tipreZcompileZsub)rr&r'r*Z append_docZprr r test_builtins3s.      zGet_argspecTest.test_builtinscCs"tjjdk r|ttjddS)Nz(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, placeholder=' [...]'))textwrapZ TextWrapperr,r#r$r rrr test_signature_wrap`s  z#Get_argspecTest.test_signature_wrapc Csddd}ddd}ddd}tj}d |d }d |d }d |d |d }xL||f||f||fgD]2\}} |j|| d|t|| WdQRXqhWdS)NdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacSrrrsrrr foojrz3Get_argspecTest.test_properly_formated..foocSrrrr4rrr barmsz3Get_argspecTest.test_properly_formated..bardbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcSrrr)r5Zzrrr bazqrz3Get_argspecTest.test_properly_formated..bazzV(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa zaaaaaaaaaaaaaaaaaaa')z!aaaaaaaaaaaaaaaaaaa') Hello GuidozRaaaaaaaaaaaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb z.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'))funcdocr3r<)r3r8)rZ_INDENTsubTestr#r$) rr6r7r9ZindentZsfooZsbarZsbazr:r;rrr test_properly_formatedhs      z&Get_argspecTest.test_properly_formatedcCs6dd}d|_|t|ddtjdddS)NcSrrrrrrr fr z2Get_argspecTest.test_docline_truncation..fA,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz() riz...)r,r#r$rZ _MAX_COLSrr?rrr test_docline_truncationsz'Get_argspecTest.test_docline_truncationcCsL|ttd|ttddd}d|_|t|ddtjdS)NzFrange(stop) -> range object range(start, stop[, step]) -> range objectzbytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes objectcSrrrrrrr r?r z3Get_argspecTest.test_multiline_docstring..fza a a a a a a a a a a a a a a ()z a)r#r$ZrangeZbytesr,rZ _MAX_LINESr@rrr test_multiline_docstrings  z(Get_argspecTest.test_multiline_docstringc Csdd}d|_ddd}d|_dd}d |_d d }d |_dd d}d|_|jdk rXdnd}xF|||||tfD]2}|j|d|t||j|WdQRXqnWdS)NcSrrrrrrr rr z*Get_argspecTest.test_functions..t1rBcSrrr)rr rrr rr z*Get_argspecTest.test_functions..t2z (a, b=None)cWrrr)rrrrr rr z*Get_argspecTest.test_functions..t3z (a, *args)cWrrrrrrr rr z*Get_argspecTest.test_functions..t4(*args)c_rrr)rr rrrrr rr z*Get_argspecTest.test_functions..t5z(a, b=None, *args, **kw) docr+)r:rr)r!r,rr=r#r$)rrrrrrr;r:rrr test_functionss  zGet_argspecTest.test_functionsc Cstjdk rdnd}xVtjtjtjtjtjtjtjfD]2}|j |d| t ||j |WdQRXq4W| t tj d|| t tjd|dS)NrFr+)meth(a)z(b))rr,rrrrrrrr=r#r$r!rr)rr;rHrrr test_methodss &$zGet_argspecTest.test_methodsc Cstjdk rdnd}xltjdftjdftjdftjdftdftjdffD]6\}}|j||d| t |||WdQRXqFWdS) NrFr+rBrEr(ci)rIrHmtip) rr,tcrrrrrr=r#r$)rr;rHrMrrr test_bound_methodss z"Get_argspecTest.test_bound_methodsc CsdGddd}|}xJ|jdf|jdffD]2\}}|j||d|t||WdQRXq*WdS)Nc@eZdZddZdS)z1Get_argspecTest.test_starred_parameter..CcWrrrrDrrr m1r z4Get_argspecTest.test_starred_parameter..C.m1N)rrr rQrrrr CrRrErL)rQr=r#r$)rrRcrHrMrrr test_starred_parameters z&Get_argspecTest.test_starred_parametercCsLGddd}Gddd}tj}|t|j||t||dS)Nc@rP)z7Get_argspecTest.test_invalid_method_get_spec..Cc[rrr)Zkwargsrrr m2r z:Get_argspecTest.test_invalid_method_get_spec..C.m2N)rrr rVrrrr rRrSrRc@rP)z:Get_argspecTest.test_invalid_method_get_spec..TestcSrrr)rrrr rr zCGet_argspecTest.test_invalid_method_get_spec..Test.__call__Nr)rrrr TestrSrW)rZ_invalid_methodr#r$rV)rrRrWrMrrr test_invalid_method_get_specs z,Get_argspecTest.test_invalid_method_get_speccCsd}dS)Nu(AΑАאاअḀあ, a)r)rZunirrr test_non_ascii_namesz#Get_argspecTest.test_non_ascii_namec CsPxJtjdftjdffD]2\}}|j||d|t||WdQRXqWdS)NrrBrL)rrrNr=r#r$)rrHrMrrr test_no_docstringsz!Get_argspecTest.test_no_docstringc CsGddd}Gddd|}Gddd|}x^|tf|tf|df|df|d ffD]2\}}|j||d |t||WdQRXqXWdS) Nc@rP)z8Get_argspecTest.test_buggy_getattr_class..NoCallcSstdSr)Z IndexError)rZnamerrr __getattr__rzDGet_argspecTest.test_buggy_getattr_class..NoCall.__getattr__N)rrr r[rrrr NoCallrSr\c@rP)z7Get_argspecTest.test_buggy_getattr_class..CallAcSrrrrrrr rrz@Get_argspecTest.test_buggy_getattr_class..CallA.__call__Nr)rrrr CallArSr]c@rP)z7Get_argspecTest.test_buggy_getattr_class..CallBcSrrr)Zouirr rTrrr rrz@Get_argspecTest.test_buggy_getattr_class..CallB.__call__Nr)rrrr CallBrSr^r+rKz (a, b, c)rL)r.r=r#r$)rr\r]r^rHrMrrr test_buggy_getattr_classsz(Get_argspecTest.test_buggy_getattr_classc CsvGdddt}Gddd|d}xN|tf|tf|dffD]2\}}|j||d|t||WdQRXq.TypeN)rrr ZpropertyZ __getitem__Z __setitem__ __class__rrrr TyperSrac@seZdZdZdS)z4Get_argspecTest.test_metaclass_class..Objectr`N)rrr Z __slots__rrrr ObjectrSrb)Z metaclassr+rL)Ztyper.r=r#r$)rrarbrHrMrrr test_metaclass_classs z$Get_argspecTest.test_metaclass_classc CsFx@ddddgifD],}|j|d|t|dWdQRXqWdS)NrgZ0s0)r%r+)r=r#r$)rr%rrr test_non_callablessz"Get_argspecTest.test_non_callablesN)rrr r0r2r>rArCrGrJrOrUrXrYrZr_rcrdrrrr r"+s-    r"c@seZdZddZddZdS)Get_entityTestcCs|tddS)Nz1/0)Z assertIsNoner get_entityr rrr test_bad_entityrzGet_entityTest.test_bad_entitycCs|tdtdS)Nint)ZassertIsrrfrhr rrr test_good_entityrzGet_entityTest.test_good_entityN)rrr rgrirrrr resreZ__main__i)Z verbosity)ZidlelibrZunittestr1r-r/rrNZ_default_callable_argspecr.Z get_argspecr$ZTestCaser"rerZmainrrrr Zs U