{G_Tc@scddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZddlmZmZmZmZmZmZddlmZejjrd"Znd#Zd jZe d eDZ!d jZ"e d eDZ#d Z$dZ%dZ&dZ'dZ(dZ)de j*fdYZ+de j*fdYZ,de+fdYZ-de j*fdYZ.e j/ejj0dde j*fdYZ1de j*fdYZ2d Z3e4d!kr_e3ndS($iN(t namedtuple(tassert_python_ok(tTESTFNtrmtreet reap_childrentcaptured_stdouttcaptured_stderrtrequires_docstrings(t pydoc_mods.dictionary for instance variables (if defined)s2list of weak references to the object (if defined)ts NAME test.pydoc_mod - This is a test module for test_pydoc FILE %s %s CLASSES __builtin__.object B C A class A | Hello and goodbye | | Methods defined here: | | __init__() | Wow, I have no function! class B(__builtin__.object) | Data descriptors defined here: | | __dict__%s | | __weakref__%s | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | NO_MEANING = 'eggs' class C(__builtin__.object) | Methods defined here: | | get_answer(self) | Return say_no() | | is_it_true(self) | Return self.get_answer() | | say_no(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) FUNCTIONS doc_func() This function solves all of the world's problems: hunger lack of Python war nodoc_func() DATA __author__ = 'Benjamin Peterson' __credits__ = 'Nobody' __version__ = '1.2.3.4' VERSION 1.2.3.4 AUTHOR Benjamin Peterson CREDITS Nobody ccs%|]}|rd|ndVqdS(s | R N((t.0ts((s+/usr/local/lib/python2.7/test/test_pydoc.pys lssg
 
 
test.pydoc_mod (version 1.2.3.4)
index
%s%s

This is a test module for test_pydoc

 
Classes
       
__builtin__.object
B
C
A

 
class A
    Hello and goodbye
 
  Methods defined here:
__init__()
Wow, I have no function!

 
class B(__builtin__.object)
     Data descriptors defined here:
__dict__
%s
__weakref__
%s

Data and other attributes defined here:
NO_MEANING = 'eggs'

 
class C(__builtin__.object)
     Methods defined here:
get_answer(self)
Return say_no()
is_it_true(self)
Return self.get_answer()
say_no(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
doc_func()
This function solves all of the world's problems:
hunger
lack of Python
war
nodoc_func()

 
Data
        __author__ = 'Benjamin Peterson'
__credits__ = 'Nobody'
__version__ = '1.2.3.4'

 
Author
        Benjamin Peterson

 
Credits
        Nobody
ccs!|]}|jddVqdS(t s N(treplace(R R ((s+/usr/local/lib/python2.7/test/test_pydoc.pys ss&no Python documentation found for '%s'sCproblem in %s - : No module named %scOs8||f}tdtj||\}}}|jS(sW Runs pydoc on the specified module. Returns the stripped output of pydoc. s-B(Rtpydoct__file__tstrip(t module_nametargstenvtrctoutterr((s+/usr/local/lib/python2.7/test/test_pydoc.pyt run_pydocs !cCsWtj}|j|}|jtp-d}|rGd|d}n|j|fS(s&Returns pydoc generated output as htmlR s
Module Docs(RtHTMLDoct docmodulet getdoclocRR(tmoduletdoctoutputtloc((s+/usr/local/lib/python2.7/test/test_pydoc.pytget_pydoc_htmls  cCsxtj}|jtpd}|r8d|d}n|j|}tjd}|jd|}|j|fS(s&Returns pydoc generated output as textR s MODULE DOCS s s.( RtTextDocRRRtretcompiletsubR(RRRRtpatt((s+/usr/local/lib/python2.7/test/test_pydoc.pytget_pydoc_texts c CsX|jt}|jt}tj||dddddd}ddj|GHd S( s"Prints unified diffs for two textstnitfromfiletexpectedttofiletgots R N(t splitlinestTruetdifflibt unified_difftjoin(ttext1ttext2tlines1tlines2tdiffs((s+/usr/local/lib/python2.7/test/test_pydoc.pyt print_diffs s  t PydocBaseTestcBs)eZddZejddZRS(cs:|ptjjtgdddfd}|S(si A version of pkgutil.walk_packages() that will restrict itself to a given path. R cs|p ||S(N((tpathtprefixtonerror(t default_patht walk_packages(s+/usr/local/lib/python2.7/test/test_pydoc.pytwrappersN(tosR7tdirnameRtNone(tselfR;R7R<((R:R;s+/usr/local/lib/python2.7/test/test_pydoc.pyt_restricted_walk_packagessccs8tj}|j||t_z dVWd|t_XdS(N(tpkgutilR;RA(R@R7R;((s+/usr/local/lib/python2.7/test/test_pydoc.pytrestrict_walk_packages"s     N(t__name__t __module__R?RAt contextlibtcontextmanagerRC(((s+/usr/local/lib/python2.7/test/test_pydoc.pyR6s t PydocDocTestcBseZeejejjdkddZeejejjdkddZ dZ dZ dZ dZ dZd ZRS( is)Docstrings are omitted with -O2 and abovecCstt\}}tjt}tjdkrNddl}|j|}n|}t|||ft }||krt |||j dndS(Ntwin32is%outputs are not equal, see diff above( RRtinspectt getabsfiletsystplatformt nturl2patht pathname2urltexpected_html_patterntexpected_html_data_docstringsR5tfail(R@tresulttdoc_loctmod_fileRNtmod_urlt expected_html((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_html_doc/s    cCs\tt\}}ttjt|ft}||krXt|||jdndS(Ns%outputs are not equal, see diff above(R%Rtexpected_text_patternRJRKtexpected_text_data_docstringsR5RR(R@RSRTt expected_text((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_text_docAs  cCs,ttj\}}|j|dddS(NR s'MODULE DOCS incorrectly includes a link(R%txmltetreet assertEqual(R@RSRT((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_issue8225MscCs1tj}zdt_tjWd|t_XdS(N(RLtstdinR?Rtgetpager(R@tprevious_stdin((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_getpager_with_stdin_noneRs   cCsjdddY}dddY}tj|}tj|}|j|jdd|dS(NtAcBseZdZRS(i*(RDRE(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRe]stBcBseZRS((RDRE(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRf_s(((Rt render_docR_R (R@ReRftadoctbdoc((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_non_str_nameZs cCs3d}t|}t|}|j||ddS(Nstest.i_am_not_heres&documentation for missing module found(Rtmissing_patternR_(R@tmissing_moduleRSR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_not_herees    cCs9d}t|}t|j}|j||ddS(Ns test.i_am_not_here sLwhite space was not stripped from module name or other error output mismatch(RRkRR_(R@RlRSR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_input_stripls   cCsetj}|j|dd|j|dd|j|dd|j|dddS(Nsss t42s(RtstripidR_(R@Rp((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_stripidts (RDRERtunittesttskipIfRLtflagstoptimizeRXR\R`RdRjRmRnRq(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRH-s    tPydocImportTestcBs,eZdZdZdZdZRS(cCs&tjt|_|jttdS(N(R=tmkdirRttest_dirt addCleanupR(R@((s+/usr/local/lib/python2.7/test/test_pydoc.pytsetUpsc Csd}d dddj|dj|fdj||ff}tjjt|tjd }xt|D]l\}}t|d }|jd j|WdQXt|d t}t ||f}|j ||qiWdS(Nt testmod_xyzzyt i_am_not_herestest.i_am_not_here_eitherti_am_not_here_eitherstest.i_am_not_here.neither_am_isi_am_not_here.neither_am_isi_am_not_here.{}stest.{}tpytws import {} t PYTHONPATH(R|R|(stest.i_am_not_here_eitherR}(stest.i_am_not_here.neither_am_isi_am_not_here.neither_am_i( tformatR=R7R/RtextseptopentwriteRtbadimport_patternR_( R@tmodnamet testpairstsourcefnt importstringt expectedinmsgtfRSR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_badimports  cCsGtjjtd}tj|tjj|dtjd}t|d}|jdWdQX|jdtgt &}t }t j dWdQXWdQX|j |jd|j |jdt &}t }t j dWdQXWdQX|j |jjd|j |jdWdQXdS( Nt syntaxerrt__init__R~Rsinvalid python syntax = $1 R7txyzzyR (R=R7R/RRwRRRRCRRRtaproposR_tgetvalueR(R@tpkgdirt badsyntaxRRR((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_apropos_with_bad_packages       cCstjjtd|_tj|jd|jtj|j|jdtg6t &}t }t j dWdQXWdQXWdQX|j |jd|j |jddS(Nt unreadableiR7tSOMEKEYR (R=R7R/Rtunreadable_dirRwRytrmdirRCRRRRR_R(R@RR((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_apropos_with_unreadable_dirs  (RDRERzRRR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRvs   tTestDescriptionscBs,eZdZdZdZdZRS(cCs3ddlm}tj|}|jd|dS(Ni(t pydocfodderR(ttestRRRgtassertIn(R@RR((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_modulescCsudddY}|}|jtj|d|jtj|ddt}|j|tj|dS(NtCcBseZdZRS(s Classic class(RDREt__doc__(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRssclass Cs instance of Csinstance of C in module %s((R_RtdescribeRDRRg(R@RtcR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_classic_classs   cCsxdtfdY}|}|jtj|d|jtj|ddt}|j|tj|dS(NRcBseZdZRS(sNew-style class(RDRER(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRssclass CsC in module %s object(tobjectR_RRRDRRg(R@RRR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_classs   cCsztdddgdt}t}tj|WdQX|j}|jd||jd||jd|dS(NtNTtabctdeftrenamet_1t_replacet_asdict(RR,RRthelpRR(R@Rthelp_iothelptext((s+/usr/local/lib/python2.7/test/test_pydoc.pyt!test_namedtuple_public_underscores  (RDRERRRR(((s+/usr/local/lib/python2.7/test/test_pydoc.pyRs   stest requires unicode supportt TestUnicodecBsPeZdZdZdZdZdZdZdZdZ RS(cCstjddjd|_djd|j_djd|j_djd|j_djd|j_|j|jj t dS(NtQsRational numbers: ℚtutf8sℚ( ttypest ModuleTypetdecodeRt __version__t__date__t __author__t __credits__tassertIsInstanceRtunicode(R@((s+/usr/local/lib/python2.7/test/test_pydoc.pyRzscCs&tj|j}|j|tdS(N(RRgRRtstr(R@R((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_render_docscCs&|jtj|jjdddS(NtasciisRational numbers: ℚ(R_Rt_encodeRR(R@((s+/usr/local/lib/python2.7/test/test_pydoc.pyt test_encodescCstj|j}tjt}t_zOtjj:tj |d|j tdj tj |WdQXWd|t_XdS(Ntpipe( RRgRR=tpopenRRt test_supportttemp_cwdt pipepagerR_treadR(R@Rtsaved((s+/usr/local/lib/python2.7/test/test_pydoc.pyttest_pipepagers/cstjj}ifd}tj|}t_z1tj|djdtj|Wd|t_XdS(NcsK|jdd!}jd|d|jt|jdsX              .  N   t     UA# X