Your IP : 216.73.216.213
�
f f�0 � @ s4 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
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 d d � Z e d k r0e � n d S)� N)�AttributesImpl)�pulldom)�run_unittest�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 QXd S)z&Minimal test of DOMEventStream.parse()�rbN)r �parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin� r �6/opt/alt/python34/lib64/python3.4/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 � } xi | D]T \ } } | t j k r | j d k r | j | � | j d t | j � � Pq q W| j d � x'