
    Mh                         d Z ddlZddlmZmZmZmZmZmZ  G d d          Z	 G d d          Z
 G d d	          Z G 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                   &    e Zd Zd Zd Zd Zd ZdS )TestNamedspacedAttributec                     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as     V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/bs4/tests/test_element.py test_name_may_be_none_or_missingz9TestNamedspacedAttribute.test_name_may_be_none_or_missing   sX    ..G||||,,G||||((G||||||    c                 f    t          d d          }|dk    sJ t          dd          }|dk    sJ d S )Ntagr   r   r   s     r   %test_namespace_may_be_none_or_missingz>TestNamedspacedAttribute.test_namespace_may_be_none_or_missing   s>    e,,EzzzzE**Ezzzzzzr   c                 6    t          dd          }d|k    sJ d S )Nr   bza:br   r   s     r   6test_attribute_is_equivalent_to_colon_separated_stringzOTestNamedspacedAttribute.test_attribute_is_equivalent_to_colon_separated_string#   s"    S))zzzzzzr   c                     t          ddd          }t          ddd          }||k    sJ t          ddd           }||k    sJ t          ddd          }||k    sJ t          ddd          }||k    sJ d S )Nr   r   czr   )r   r   r   r   des         r   ;test_attributes_are_equivalent_if_prefix_and_name_identicalzTTestNamedspacedAttribute.test_attributes_are_equivalent_if_prefix_and_name_identical'   s    S#..S#..Avvvv  S$//Avvvv  S#..AvvvvS#..Avvvvvvr   N)__name__
__module____qualname__r   r   r   r     r   r   r
   r
      sP                  r   r
   c                       e Zd ZdZd Zd ZdS ))TestAttributeValueWithCharsetSubstitutionzpCertain attributes are designed to have the charset of the
    final document substituted into their value.
    c                     t          d          }d|k    sJ d|j        k    sJ d|                    d          k    sJ d|                    d          k    sJ d|                    d          k    sJ d S )Nzeuc-jputf8asciir   palmos)r   original_valuesubstitute_encodingr   values     r   !test_charset_meta_attribute_valuezKTestAttributeValueWithCharsetSubstitution.test_charset_meta_attribute_value=   s     *(335    5/////226::::::%33G<<<<<< U..x88888888r   c                     t          d          }d|k    sJ d|j        k    sJ d|                    d          k    sJ d|                    d          k    sJ d|                    d          k    sJ d S )Nztext/html; charset=euc-jpztext/html; charset=utf8r(   ztext/html; charset=asciir)   z	text/htmlr*   )r   r+   r,   r-   s     r   !test_content_meta_attribute_valuezKTestAttributeValueWithCharsetSubstitution.test_content_meta_attribute_valueJ   s    )*EFF*e3333*e.BBBBB(E,E,Ef,M,MMMMM)U-F-Fw-O-OOOOO e77AAAAAAAAr   N)r!   r"   r#   __doc__r/   r1   r$   r   r   r&   r&   8   sA         9 9 9	B 	B 	B 	B 	Br   r&   c                       e Zd Zd Zd ZdS )TestAttributeDictsc                     t                      }d|d<   |d         dk    sJ d|d<   |d         dk    sJ d|d<   |d         du sJ d|d<   |d         du sJ d |d<   |d         dk    sJ d S )	Nd   v100Zd;Y@100.123FTr   )r   )r   r   s     r   !test_xml_attribute_value_handlingz4TestAttributeDicts.test_xml_attribute_value_handlingW   s     #v#v"""" #v#v~~~~#v||||||r   c                    t                      }d|d<   |d         dk    sJ d|d<   |d         dk    sJ d|d<   d|vsJ d |d<   d|vsJ d|d<   |d         dk    sJ t          dd	d
          }d||<   ||         d	k    sJ d S )Nr6   r7   r8   r9   r:   FTprefixname	namespace)r   r   )r   r   	attributes      r   "test_html_attribute_value_handlingz5TestAttributeDicts.test_html_attribute_value_handlingk   s     #v#v""""#!||||#!||||#v}}}}'&+FF	)|v%%%%%%r   N)r!   r"   r#   r;   rA   r$   r   r   r4   r4   V   s2          (& & & & &r   r4   c                       e Zd Zd ZdS )TestResultSetc                     t          d           }t          j        t                    5 }|j         d d d            n# 1 swxY w Y   dt          |j                  k    sJ 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   pytestraisesAttributeErrorr>   strr.   )r   rsr   s      r   test_getattr_exceptionz$TestResultSet.test_getattr_exception   s    t__]>** 	aGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 v17||     s   =AAN)r!   r"   r#   rJ   r$   r   r   rC   rC      s#        
 
 
 
 
r   rC   )r2   rE   bs4.elementr   r   r   r   r   r   r
   r&   r4   rC   r$   r   r   <module>rL      s                   $ $ $ $ $ $ $ $NB B B B B B B B<)& )& )& )& )& )& )& )&X
 
 
 
 
 
 
 
 
 
r   