D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.6
/
site-packages
/
bs4
/
tests
/
__pycache__
/
Filename :
test_tree.cpython-36.pyc
back
Copy
3 6]�8 � @ s d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl m Z mZ ddlm Z mZmZmZmZmZmZmZ ddlmZmZ e jd�dk Ze jd �dk ZG d d� de�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd� de�Z#G dd� de#�Z$G dd� de#�Z%G d d!� d!e�Z&G d"d#� d#e&�Z'G d$d%� d%e&�Z(G d&d'� d'e�Z)G d(d)� d)e�Z*G d*d+� d+e�Z+G d,d-� d-e�Z,G d.d/� d/e�Z-G d0d1� d1e�Z.G d2d3� d3e�Z/G d4d5� d5e�Z0G d6d7� d7e�Z1dS )8a8 Tests for Beautiful Soup's tree traversal methods. The tree traversal methods are the main advantage of using Beautiful Soup over just using a parser. Different parsers will build different Beautiful Soup trees given the same markup, but all Beautiful Soup trees can be traversed with the methods tested here. � )� set_traceN)� BeautifulSoup)�builder_registry�HTMLParserTreeBuilder)�PY3K�CData�Comment�Declaration�Doctype�NavigableString�SoupStrainer�Tag)�SoupTest�skipIfZxmlZlxmlc @ s e Zd Zdd� Zdd� ZdS )�TreeTestc C s | j dd� |D �|� dS )z�Make sure that the given tags have the correct text. This is used in tests that define a bunch of tags, each containing a single string, and then select certain strings by some mechanism. c S s g | ] }|j �qS � )�string)�.0�tagr r �/usr/lib/python3.6/test_tree.py� <listcomp>2 s z*TreeTest.assertSelects.<locals>.<listcomp>N)�assertEqual)�self�tags�should_matchr r r � assertSelects+ s zTreeTest.assertSelectsc C s | j dd� |D �|� dS )z�Make sure that the given tags have the correct IDs. This is used in tests that define a bunch of tags, each containing a single string, and then select certain strings by some mechanism. c S s g | ]}|d �qS )�idr )r r r r r r ; s z-TreeTest.assertSelectsIDs.<locals>.<listcomp>N)r )r r r r r r �assertSelectsIDs4 s zTreeTest.assertSelectsIDsN)�__name__� __module__�__qualname__r r r r r r r ) s r c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� ZdS ) �TestFindz�Basic tests of the find() method. find() just calls find_all() with limit=1, so it's not tested all that thouroughly here. c C s"