;
Ëâ"Ic            
   @   sš   d  d l  m Z d  d l Z d  d l m Z d  d l Z d  d l Z d  d l Z d a
 d „  Z Gd „  d e j ƒ Z d „  Z e d k o e ƒ  n d S(	   i    (   u   DocXMLRPCServerN(   u   supportc             C   s  t  d d d ƒ} zØ yº | j j ƒ  d a | j d ƒ | j d ƒ | j d ƒ Gd „  d	 t ƒ } | j	 ƒ  | j
 | ƒ  ƒ d
 „  } | j | ƒ | j d „  ƒ x& | d k o | j ƒ  | d 8} q¨ WWn t j k
 o Yn XWd  | j ƒ  d  a |  j ƒ  Xd  S(   Nu	   localhosti    u   logRequestsi   u"   DocXMLRPCServer Test Documentationu   DocXMLRPCServer Test Docsum   This is an XML-RPC server's documentation, but the server can be used by
POSTing to /RPC2. Try self.add, too.c             B   s   |  Ee  Z d  „  Z d S(   c             S   s   | |  _  d S(   u7   Test method's docs. This method truly does very little.N(   u   arg(   u   selfu   arg(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_method   s    N(   u   __name__u
   __module__u   test_method(   u
   __locals__(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu	   TestClass   s   
u	   TestClassc             S   s   |  | S(   u  Add two instances together. This follows PEP008, but has nothing
            to do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
            that start with http and ftp should be auto-linked, too:
            http://google.com.
            (    (   u   xu   y(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   add!   s    c             S   s   |  | S(    (    (   u   xu   y(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   <lambda>*   s    (   u	   localhosti    F(   u   DocXMLRPCServeru   Falseu   socketu   getsocknameu   PORTu   set_server_titleu   set_server_nameu   set_server_documentationu   objectu    register_introspection_functionsu   register_instanceu   register_functionu   handle_requestu   timeoutu   server_closeu   Noneu   set(   u   evtu   numrequestsu   servu	   TestClassu   add(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   server
   s.     
	 


c             B   sV   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d S(	   c             C   s™   d t _ t j ƒ  |  _ t j d t d |  j d f ƒ j ƒ  d } x6 | d k o( t	 d  k o t j d ƒ | d 8} qF Wt j j d t	 ƒ |  _ d  S(	   Nu   targetu   argsi   iè  i    gü©ñÒMbP?u   localhost:%dT(   u   Trueu   DocXMLRPCServeru   _send_traceback_headeru	   threadingu   Eventu   evtu   Threadu   serveru   startu   PORTu   Noneu   timeu   sleepu   httpu   clientu   HTTPConnection(   u   selfu   n(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   setUp7   s    	% c             C   s'   |  j  j ƒ  |  j j ƒ  d t _ d  S(   NF(   u   clientu   closeu   evtu   waitu   Falseu   DocXMLRPCServeru   _send_traceback_header(   u   self(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   tearDownF   s    c             C   s\   |  j  j d d ƒ |  j  j ƒ  } |  j | j d ƒ |  j | j d ƒ d ƒ | j ƒ  d  S(   Nu   GETu   /iÈ   u   Content-typeu	   text/html(   u   clientu   requestu   getresponseu   assertEqualu   statusu	   getheaderu   read(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_valid_get_responseN   s
    c             C   s\   |  j  j d d ƒ |  j  j ƒ  } |  j | j d ƒ |  j | j d ƒ d ƒ | j ƒ  d  S(   Nu   GETu   /spami”  u   Content-typeu
   text/plain(   u   clientu   requestu   getresponseu   assertEqualu   statusu	   getheaderu   read(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_invalid_get_responseX   s
    c             C   s?   |  j  j d d ƒ |  j  j ƒ  } |  j d | j ƒ  k ƒ d S(   ué   Test that lambda functionality stays the same.  The output produced
        currently is, I suspect invalid because of the unencoded brackets in the
        HTML, "<lambda>".

        The subtraction lambda method is tested.
        u   GETu   /sU   <dl><dt><a name="-&lt;lambda&gt;"><strong>&lt;lambda&gt;</strong></a>(x, y)</dt></dl>N(   u   clientu   requestu   getresponseu   assert_u   read(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_lambdaa   s
    c             C   sB   |  j  j d d ƒ |  j  j ƒ  j ƒ  } |  j d | k | ƒ d S(   u  Test that the server correctly automatically wraps references to PEPS
        and RFCs with links, and that it linkifies text starting with http or
        ftp protocol prefixes.

        The documentation for the "add" method contains the test material.
        u   GETu   /sM  <dl><dt><a name="-add"><strong>add</strong></a>(x, y)</dt><dd><tt>Add&nbsp;two&nbsp;instances&nbsp;together.&nbsp;This&nbsp;follows&nbsp;<a href="http://www.python.org/dev/peps/pep-0008/">PEP008</a>,&nbsp;but&nbsp;has&nbsp;nothing<br>
to&nbsp;do&nbsp;with&nbsp;<a href="http://www.rfc-editor.org/rfc/rfc1952.txt">RFC1952</a>.&nbsp;Case&nbsp;should&nbsp;matter:&nbsp;pEp008&nbsp;and&nbsp;rFC1952.&nbsp;&nbsp;Things<br>
that&nbsp;start&nbsp;with&nbsp;http&nbsp;and&nbsp;ftp&nbsp;should&nbsp;be&nbsp;auto-linked,&nbsp;too:<br>
<a href="http://google.com">http://google.com</a>.</tt></dd></dl>N(   u   clientu   requestu   getresponseu   readu   assert_(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_autolinkingo   s
    c             C   s?   |  j  j d d ƒ |  j  j ƒ  j ƒ  } |  j d | k ƒ d S(   u³   Test the precense of three consecutive system.* methods.

        This also tests their use of parameter type recognition and the systems
        related to that process.
        u   GETu   /s•  <dl><dt><a name="-system.methodHelp"><strong>system.methodHelp</strong></a>(method_name)</dt><dd><tt><a href="#-system.methodHelp">system.methodHelp</a>('add')&nbsp;=&gt;&nbsp;"Adds&nbsp;two&nbsp;integers&nbsp;together"<br>
&nbsp;<br>
Returns&nbsp;a&nbsp;string&nbsp;containing&nbsp;documentation&nbsp;for&nbsp;the&nbsp;specified&nbsp;method.</tt></dd></dl>
<dl><dt><a name="-system.methodSignature"><strong>system.methodSignature</strong></a>(method_name)</dt><dd><tt><a href="#-system.methodSignature">system.methodSignature</a>('add')&nbsp;=&gt;&nbsp;[double,&nbsp;int,&nbsp;int]<br>
&nbsp;<br>
Returns&nbsp;a&nbsp;list&nbsp;describing&nbsp;the&nbsp;signature&nbsp;of&nbsp;the&nbsp;method.&nbsp;In&nbsp;the<br>
above&nbsp;example,&nbsp;the&nbsp;add&nbsp;method&nbsp;takes&nbsp;two&nbsp;integers&nbsp;as&nbsp;arguments<br>
and&nbsp;returns&nbsp;a&nbsp;double&nbsp;result.<br>
&nbsp;<br>
This&nbsp;server&nbsp;does&nbsp;NOT&nbsp;support&nbsp;system.methodSignature.</tt></dd></dl>
<dl><dt><a name="-test_method"><strong>test_method</strong></a>(arg)</dt><dd><tt>Test&nbsp;method's&nbsp;docs.&nbsp;This&nbsp;method&nbsp;truly&nbsp;does&nbsp;very&nbsp;little.</tt></dd></dl>N(   u   clientu   requestu   getresponseu   readu   assert_(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_system_methods}   s    c             C   s?   |  j  j d d ƒ |  j  j ƒ  } |  j d | j ƒ  k ƒ d S(   uT   Test that selfdot values are made strong automatically in the
        documentation.u   GETu   /s-   Try&nbsp;self.<strong>add</strong>,&nbsp;too.N(   u   clientu   requestu   getresponseu   assert_u   read(   u   selfu   response(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   test_autolink_dotted_methods‰   s    	N(
   u   __name__u
   __module__u   setUpu   tearDownu   test_valid_get_responseu   test_invalid_get_responseu   test_lambdau   test_autolinkingu   test_system_methodsu   test_autolink_dotted_methods(   u
   __locals__(    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   DocXMLRPCHTTPGETServer6   s   
			
					u   DocXMLRPCHTTPGETServerc               C   s   t  j t ƒ d  S(   N(   u   supportu   run_unittestu   DocXMLRPCHTTPGETServer(    (    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu	   test_main’   s    u   __main__(   u   xmlrpc.serveru   DocXMLRPCServeru   http.clientu   httpu   testu   supportu	   threadingu   timeu   unittestu   Noneu   PORTu   serveru   TestCaseu   DocXMLRPCHTTPGETServeru	   test_mainu   __name__(    (    (    u0   /mit/python/lib/python3.0/test/test_docxmlrpc.pyu   <module>   s   	,\	