a
    Cg                     @   sh   d Z ddlZddlmZmZmZmZmZmZ G dd dZ	G dd dZ
G dd	 d	ZG d
d dZdS )zTests of classes in element.py.

The really big classes -- Tag, PageElement, and NavigableString --
are tested in separate files.
    N)HTMLAttributeDictXMLAttributeDictCharsetMetaAttributeValueContentMetaAttributeValueNamespacedAttribute	ResultSetc                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestNamedspacedAttributec                 C   sD   t dd }|dksJ t dd}|dks,J t d}|dks@J d S )Nxmlns r   selfa r   U/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/bs4/tests/test_element.py test_name_may_be_none_or_missing   s    

z9TestNamedspacedAttribute.test_name_may_be_none_or_missingc                 C   s0   t d d}|dksJ t dd}|dks,J d S )Ntagr
   r   r   r   r   r   %test_namespace_may_be_none_or_missing   s    

z>TestNamedspacedAttribute.test_namespace_may_be_none_or_missingc                 C   s   t dd}d|ksJ d S )Nr   bza:br   r   r   r   r   6test_attribute_is_equivalent_to_colon_separated_string#   s    
zOTestNamedspacedAttribute.test_attribute_is_equivalent_to_colon_separated_stringc                 C   sp   t ddd}t ddd}||ks$J t ddd }||ks<J t ddd}||ksTJ t ddd}||kslJ d S )Nr   r   czr   )r   r   r   r   der   r   r   ;test_attributes_are_equivalent_if_prefix_and_name_identical'   s    zTTestNamedspacedAttribute.test_attributes_are_equivalent_if_prefix_and_name_identicalN)__name__
__module____qualname__r   r   r   r   r   r   r   r   r      s   
r   c                   @   s    e Zd ZdZdd Zdd ZdS ))TestAttributeValueWithCharsetSubstitutionzpCertain attributes are designed to have the charset of the
    final document substituted into their value.
    c                 C   s\   t d}d|ksJ d|jks"J d|dks4J d|dksFJ d|dksXJ d S )Nzeuc-jputf8asciir
   palmos)r   original_valuesubstitute_encodingr   valuer   r   r   !test_charset_meta_attribute_value=   s    zKTestAttributeValueWithCharsetSubstitution.test_charset_meta_attribute_valuec                 C   s\   t d}d|ksJ d|jks"J d|dks4J d|dksFJ d|dksXJ d S )Nztext/html; charset=euc-jpztext/html; charset=utf8r   ztext/html; charset=asciir    z	text/htmlr!   )r   r"   r#   r$   r   r   r   !test_content_meta_attribute_valueJ   s    zKTestAttributeValueWithCharsetSubstitution.test_content_meta_attribute_valueN)r   r   r   __doc__r&   r'   r   r   r   r   r   8   s   r   c                   @   s   e Zd Zdd Zdd ZdS )TestAttributeDictsc                 C   s   t  }d|d< |d dksJ d|d< |d dks6J d|d< |d du sNJ d|d< |d du sfJ d |d< |d dks~J d S )	Nd   v100Zd;Y@100.123FTr
   )r   )r   r   r   r   r   !test_xml_attribute_value_handlingW   s    z4TestAttributeDicts.test_xml_attribute_value_handlingc                 C   s   t  }d|d< |d dksJ d|d< |d dks6J d|d< d|vsJJ d |d< d|vs^J d|d< |d dksvJ tdd	d
}d||< || d	ksJ d S )Nr*   r+   r,   r-   r.   FTprefixname	namespace)r   r   )r   r   	attributer   r   r   "test_html_attribute_value_handlingk   s    z5TestAttributeDicts.test_html_attribute_value_handlingN)r   r   r   r/   r4   r   r   r   r   r)   V   s   r)   c                   @   s   e Zd Zdd ZdS )TestResultSetc                 C   sN   t d }tt}|j W d    n1 s.0    Y  dt|jksJJ d S )NzResultSet object has no attribute "name". You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?)r   pytestZraisesAttributeErrorr1   strr%   )r   rsr   r   r   r   test_getattr_exception   s    $z$TestResultSet.test_getattr_exceptionN)r   r   r   r:   r   r   r   r   r5      s   r5   )r(   r6   Zbs4.elementr   r   r   r   r   r   r   r   r)   r5   r   r   r   r   <module>   s    	',