File: //usr/local/lib/python3.10/test/__pycache__/test_pulldom.cpython-310.opt-2.pyc
o
�i�2 � @ 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�Zedkrje�� dS 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 @ sP e Zd Zdd� Zdd� Zdd� Zejdd� �Zejd d
� �Z dd� Z
d
d� ZdS )�PullDOMTestCasec C s` t �t�}| �|jj� t|� ttd��}tt �|�� W d � d S 1 s)w Y d S )N�rb)r �parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin� r �./usr/local/lib/python3.10/test/test_pulldom.py�
test_parse s
"�zPullDOMTestCase.test_parsec C s� t �t�}t|�\}}| �t|d�� | �t j|� t|�\}}| �t j|� | �d|j � | �dt
|j�� | �|j�d�j
d� t|�\}}| �t j|� t|�\}}| �t j|� t|�\}}| �d|j � |}t|�\}}| �t j|� | �d|j� t|�\}}| �t j|� | �d|j � | �||u � t|�\}}| �t j|� t|�\}}| �t j|� | �d|j � t|�\}}| �t j|� | �d|j � t|�\}}| �t j|� t|�\}}| �t j|� | �d |j � t|�\}}| �t j|� | �d
|j � t|�\}}| �t j|� t|�\}}| �t j|� | �d
|j � t|�\}}| �t j|� t|�\}}| �t j|� t|�\}}| �t j|� d S )N�
createElement�html� z xmlns:xdczhttp://www.xml.com/books�titlezIntroduction to XSL�hr�pz
xdc:author)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+ sj
�z$PullDOMTestCase.test_parse_semanticsc C s@ t �t�}|D ]\}}|t jkr&|jdkr&|�|� | �dt|j�� nq| � d� |D ]\}}|t jkr9 nq.| �d|jd� |�|� | �t
|�d t j� t
|�\}}| �|jd� |�|� t
|� t
|�\}}| �|jd� | �t
�� t
|� W d � n1 s�w Y |�� | �|j� | �|j� d S ) Nr � z,No "title" element detected in SMALL_SAMPLE!r z=expandNode did not leave DOMEventStream in the correct state.r r r )r r r r! r"