shell bypass 403
o
ab�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 � dS 1 s(w Y dS )z&Minimal test of DOMEventStream.parse()�rbN)r �parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin� r �:/usr/local/python-3.10/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|� 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+ sh
�z$PullDOMTestCase.test_parse_semanticsc C s> t �t�}|D ]\}}|t jkr%|jdkr%|�|� | �dt|j�� q+q| � d� |D ]\}}|t jkr8 q9q-| �d|jd� |�|� | �t
|�d t j� t
|�\}}| �|jd� |�|� t
|� t
|�\}}| �|jd� | �t
�� t
|� W d � n1 s�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! r"