Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_pulldom.cpython-311.pyc |
�
�KeT1 � �j � d dl Z d dlZd dlZd dlmZ d dlmZ d dlm Z d dl
mZ edd�� � Zd Z
G d
� dej � � Z G d� d
ej � � Z G d� de� � Z G d� de� � Z G d� de j � � Z G d� dej � � Zedk r ej � � dS dS )� N)�AttributesImpl)�feature_external_ges)�pulldom)�findfileztest.xml�xmltestdata)�subdira
<?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 �f � e Zd Zd� Zd� Zd� Zej d� � � Zej d� � � Z d� Z
dS )�PullDOMTestCasec �2 � t j t � � }| � |j j � � t
|� � t t d� � 5 }t
t j |� � � � ddd� � dS # 1 swxY w Y dS )z&Minimal test of DOMEventStream.parse()�rbN)r �parse�tstfile�
addCleanup�stream�close�list�open)�self�handler�fins �;/usr/local/apps/python3/lib/python3.11/test/test_pulldom.py�
test_parsezPullDOMTestCase.test_parse s� � � �-��(�(�������,�-�-�-��W�
�
�
� �'�4�
�
� %�C����s�#�#�$�$�$� %� %� %� %� %� %� %� %� %� %� %� %���� %� %� %� %� %� %s �"B�B�Bc �
� t j 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 |� � 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�len�
attributes�getNamedItem�value�
CHARACTERS�data�END_ELEMENT)r �items�evt�node�
title_nodes r �test_parse_semanticsz$PullDOMTestCase.test_parse_semantics+ s4 � � �#�L�1�1����K�K� ��T������o�6�6�7�7�7�����/��5�5�5���K�K� ��T�����.��4�4�4�������.�.�.�����C���0�0�1�1�1������5�5�k�B�B�H�(� *� *� *���K�K� ��T�����+�S�1�1�1���K�K� ��T�
����+�S�1�1�1���K�K� ��T�����$�,�/�/�/��
���K�K� ��T�����+�S�1�1�1����.�� �:�:�:���K�K� ��T�����,�c�2�2�2�����$�,�/�/�/����
�d�*�+�+�+���K�K� ��T�����+�S�1�1�1���K�K� ��T�����.��4�4�4�����t�|�,�,�,���K�K� ��T�����,�c�2�2�2�����t�|�,�,�,���K�K� ��T�����+�S�1�1�1���K�K� ��T�����.��4�4�4�����d�l�+�+�+���K�K� ��T�����.��4�4�4�����t�|�4�4�4���K�K� ��T�����+�S�1�1�1���K�K� ��T�����,�c�2�2�2�����t�|�4�4�4���K�K� ��T�����,�c�2�2�2���K�K� ��T�����+�S�1�1�1���K�K� ��T�����,�c�2�2�2�2�2� c �0 � t j t � � }|D ]_\ }}|t j k rJ|j dk r?|� |� � | � dt |j � � � � n�`| � d� � |D ]\ }}|t j k r n�| � d|j d� � |� |� � | � t |� � d t j � � t |� � \ }}| � |j d� � |� |� � t |� � t |� � \ }}| � |j d� � | � t � � 5 t |� � d d d � � n# 1 swxY w Y |� � � | � |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'