Your IP : 216.73.216.52
��YfQ0 � @ s" d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m
Z
e
d d d �Z d Z Gd d
� d
e j
� Z Gd d � d e j
� Z Gd
d � d e � Z Gd d � d e � Z Gd d � d e j � Z Gd d � d e j
� Z e d k re j � d S)� N)�AttributesImpl)�pulldom)�findfileztest.xmlZsubdirZxmltestdataa
<?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 @ s^ e Z d Z d d � Z d d � Z d d � Z e j d d � � Z e j d d
� � Z d S)�PullDOMTestCasec
C s\ t j t � } | j | j j � t | � t t d � � } t t j | � � Wd QRXd S)z&Minimal test of DOMEventStream.parse()�rbN)r �parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin� r �6/opt/alt/python35/lib64/python3.5/test/test_pulldom.py�
test_parse s
zPullDOMTestCase.test_parsec C s� t j t � } t | � \ } } | j t | d � � | j t j | � t | � \ } } | j t j | � | j d | j � | j d t
| j � � | j | j j d � j
d � t | � \ } } | j t j | � t | � \ } } | j t j | � t | � \ } } | j d | j � | } t | � \ } } | j t j | � | j d | j � t | � \ } } | j t j | � | j d | j � | j | | k � t | � \ } } | j t j | � t | � \ } } | j t j | � | j d | j � t | � \ } } | j t j | � | j d | j � t | � \ } } | j t j | � t | � \ } } | j t j | � | j d | j � t | � \ } } | j t j | � | j d
| j � t | � \ } } | j t j | � t | � \ } } | j t j | � | j d
| j � t | � \ } } | j t j | � t | � \ } } | j t j | � t | � \ } } | j t j | � d S)z&Test DOMEventStream parsing semantics.�
createElement�html� z xmlns:xdczhttp://www.xml.com/books�titlezIntroduction to XSL�hr�pz
xdc:authorN)r �parseString�SMALL_SAMPLE�next�
assertTrue�hasattr�assertEqual�START_DOCUMENT�
START_ELEMENT�tagName�lenZ
attributesZgetNamedItem�value�
CHARACTERS�data�END_ELEMENT)r
�items�evt�nodeZ
title_noder r r �test_parse_semantics+ sf z$PullDOMTestCase.test_parse_semanticsc C s� t j t � } xf | D]Q \ } } | t j k r | j d k r | j | � | j d t | j � � Pq W| j d � x$ | D] \ } } | t j k r Pq W| j d | j d � | j | � | j t
| � d t j � t
| � \ } } | j | j d � | j | � t
| � t
| � \ } } | j | j d � | j t
� � t
| � Wd QRX| j � | j | j � | j | j � d S)
z$Ensure expandItem works as expected.r � z,No "title" element detected in SMALL_SAMPLE!r z=expandNode did not leave DOMEventStream in the correct state.r r r N)r r r r r! Z
expandNoder r"