File: //lib64/python3.6/test/__pycache__/test_pulldom.cpython-36.pyc
3
\T1 � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlm Z d dl
mZ eddd�Zd Z
G d
d� dej�ZG dd
� d
ej�ZG dd� de�ZG dd� de�ZG dd� de j�ZG dd� dej�Zedkr�ej� dS )� N)�AttributesImpl)�feature_external_ges)�pulldom)�findfileztest.xmlZxmltestdata)Zsubdira
<?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 @ sH e Zd Zdd� Zdd� Zdd� Zejdd� �Zejd d
� �Z dd� Z
d
S )�PullDOMTestCasec
C sH t jt�}| j|jj� t|� ttd��}tt j|�� W dQ R X dS )z&Minimal test of DOMEventStream.parse()�rbN)r �parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin� r �$/usr/lib64/python3.6/test_pulldom.py�
test_parse s
zPullDOMTestCase.test_parsec C s� t jt�}t|�\}}| jt|d�� | jt j|� t|�\}}| jt j|� | jd|j � | jdt
|j�� | j|jjd�j
d� t|�\}}| jt j|� t|�\}}| jt j|� t|�\}}| jd|j � |}t|�\}}| jt j|� | jd|j� t|�\}}| jt j|� | jd|j � | j||k� t|�\}}| jt j|� t|�\}}| jt j|� | jd|j � t|�\}}| jt j|� | jd|j � t|�\}}| jt j|� t|�\}}| jt j|� | jd |j � t|�\}}| jt j|� | jd
|j � t|�\}}| jt j|� t|�\}}| jt j|� | jd
|j � t|�\}}| jt j|� t|�\}}| jt j|� t|�\}}| jt j|� dS )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 jt�}xL|D ]:\}}|t jkr|jdkr|j|� | jdt|j�� P qW | j d� x|D ]\}}|t jkr^P q^W | jd|jd� |j|� | jt
|�d t j� t
|�\}}| j|jd� |j|� t
|� t
|�\}}| j|jd� | jt
�� t
|� W d Q R X |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"