
    0hhd                     z    S SK r S SKrS SKJr  S SKJr  S SKJr  S SKJrJ	r	J
r
  Sr " S S\R                  5      rg)	    N)client)
FakeSocket)mock)getDOMImplementationminidom
xmlbuilders  <?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xdc="http://www.xml.com/books">
<!-- A comment -->
<title>Introduction to XSL</title>
<hr/>
<p><xdc:author xdc:attrib="prefixed attribute" attrib="other attrib">A. Namespace</xdc:author></p>
</html>c                   ,    \ rS rSrS rS rS rS rSrg)XMLBuilderTest   c                 (   S[         -   n[        U5      n[        R                  " U5      nUR	                  5         SU0n[
        R                  " S0 UD6n[        R                  " 5       n[
        R                  " S5       nXWl
        UR                  S S5      nS S S 5        U R                  W[        R                  5        U R                  UR                  5        U R!                  UR"                  S5        U R!                  UR$                  S5        U R!                  UR&                  S5        U R)                  UR*                  U5        U R                  UR,                  5        U R                  UR.                  5        g ! , (       d  f       N= f)N:   HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

open.return_valueurllib.request.build_openerhttp://example.com/2000/svgzhttp://example.com/2000/zutf-8 )SMALL_SAMPLEr   r   HTTPResponsebeginr   Mockr   DOMEntityResolverpatchreturn_valueresolveEntityassertIsInstanceDOMInputSourceassertIsNonepublicIdassertEqualsystemIdbaseURIencodingassertIs
byteStreamcharacterStream
stringData)	selfbodysockresponseattrsopenerresolver
mock_buildsources	            E/opt/python-3.13.8/usr/lib/python3.13/test/test_xml_dom_xmlbuilder.pytest_entity_resolver#XMLBuilderTest.test_entity_resolver   s;   O 	
 $&&t,$h/#U#//1ZZ56*&,#++D2OPF 7 	fj&?&?@&//**GH)CD'2f''2&001&++, 76s    F
Fc                     [        5       nU R                  U[        R                  5        UR	                  UR
                  S 5      nU R                  U[        R                  5        g )N)r   r   r   DOMImplementationLScreateDOMBuilderMODE_SYNCHRONOUS
DOMBuilder)r&   impbuilders      r/   test_builderXMLBuilderTest.test_builder.   sN    "$c:#A#AB&&s';';TBgz'<'<=    c                    S[         -   n[        U5      n[        R                  " U5      nUR	                  5         SU0n[
        R                  " S0 UD6n[
        R                  " S5       nXVl        [        5       nUR                  UR                  S 5      nUR                  S5      n	S S S 5        U R                  W	[        R                  5        U R!                  [#        U	R$                  5      S5        g ! , (       d  f       NT= f)Nr   r   r   r      r   )r   r   r   r   r   r   r   r   r   r   r4   r5   parseURIr   r   Documentr   len
childNodes)
r&   r'   r(   r)   r*   r+   r-   r7   r8   documents
             r/   test_parse_uriXMLBuilderTest.test_parse_uri5   s    O 	
 $&&t,$h/#U#ZZ56*&,#&(C**3+?+?FG''(EFH 7 	h(8(89X00115 76s   +>C77
Dc                    [         R                  " [        5      n[        R                  " S5       nXl        [        5       nUR                  5       nUR                  UR                  S 5      nSUl
        UR                  U5      nS S S 5        U R                  W[        R                  5        U R                  [!        UR"                  5      S5        g ! , (       d  f       NT= f)Nzurllib.request.urlopenr   r=   )ioBytesIOr   r   r   r   r   createDOMInputSourcer4   r5   r   parser   r   r?   r   r@   rA   )r&   r)   	mock_openr7   r.   r8   rB   s          r/   test_parse_with_systemId'XMLBuilderTest.test_parse_with_systemIdK   s    ::l+ZZ01Y%-"&(C--/F**3+?+?FG;FO}}V,H 2 	h(8(89X00115 21s   AC
C"r   N)	__name__
__module____qualname____firstlineno__r0   r9   rC   rK   __static_attributes__r   r;   r/   r
   r
      s    -8>6,6r;   r
   )rF   unittesthttpr   test.test_httplibr   r   xml.domr   r   r   r   TestCaser
   r   r;   r/   <module>rW      s5    	   (  = =G6X&& G6r;   