
    ,h                         d Z ddlZddlZddlmZ ddlmZmZm	Z	 	 ddlm
Z
 dZ	 ddlmZmZ dZ G d	 d
ej                         Z G d dej                         Zy# e$ r dZY ?w xY w# e$ r dZY Aw xY w)zTests of the builder registry.    N)BeautifulSoup)builder_registryHTMLParserTreeBuilderTreeBuilderRegistry)HTML5TreeBuilderTF)LXMLTreeBuilderForXMLLXMLTreeBuilderc                   (    e Zd ZdZd Zd Zd Zd Zy)BuiltInRegistryTestz@Test the built-in registry with the default builders registered.c                 z   t         r*| j                  t        j                  dd      t               t         r*| j                  t        j                  dd      t
               | j                  t        j                  dd      t               t        r+| j                  t        j                  dd      t               y y )Nfasthtml
permissivexmlstricthtml5lib)	LXML_PRESENTassertEqualregistrylookupr	   r   r   HTML5LIB_PRESENTr   selfs    a/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/bs4/tests/test_builder_registry.pytest_combinationz$BuiltInRegistryTest.test_combination    s    X__VV<,. X__\5A246:/	1X__Z@.0     c                    t         rS| j                  t        j                  d      t               | j                  t        j                  d      t
               y | j                  t        j                  d      d        t        r*| j                  t        j                  d      t               y | j                  t        j                  d      t               y )Nr   r   )	r   r   r   r   r	   r   r   r   r   r   s    r   test_lookup_by_markup_typez.BuiltInRegistryTest.test_lookup_by_markup_type.   s    X__V4oFX__U35JKX__U3T:  !8:JK  !8:OPr   c                 h   t         rT| j                  t        j                  dd      t               | j                  t        j                  dd      t
               t        r)| j                  t        j                  d      t               | j                  t        j                  d      t               y )Nlxmlr   r   r   zhtml.parser)	r   r   r   r   r   r	   r   r   r   r   s    r   test_named_libraryz&BuiltInRegistryTest.test_named_library9   s~    X__VU;24X__VV<,.X__Z8.0 	7/	1r   c                     t        j                  d      5 }t        dd       t        dddg       d d d        | j                  t        t        dd       y # 1 sw Y   'xY w)NT)record r   )featuresr   zno-such-feature)warningscatch_warningsr   assertRaises
ValueError)r   ws     r   *test_beautifulsoup_constructor_does_lookupz>BuiltInRegistryTest.test_beautifulsoup_constructor_does_lookupF   sa    $$D1 	9Q
 "v."'78	9 	*m'8 	 	:	9 	9s   AA#N)__name__
__module____qualname____doc__r   r   r!   r+    r   r   r   r      s    J0	Q1:r   r   c                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)RegistryTestz.Test the TreeBuilderRegistry class in general.c                 "    t               | _        y N)r   r   r   s    r   setUpzRegistryTest.setUpY   s    +-r   c                     t        ddj                  |      z   t        fd|i      }| j                  j	                  |       |S )NBuilder__r%   )typejoinobjectr   register)r   feature_listclss      r   builder_for_featuresz!RegistryTest.builder_for_features\   sA    : 669zL9; 	s#
r   c                     | j                         }| j                  | j                  j                  d      d        | j                  | j                  j                         |       y )Nfoor?   r   r   r   r   builders     r   test_register_with_no_featuresz+RegistryTest.test_register_with_no_featuresc   sP    ++- 	--e4d; 	--/9r   c                     | j                  dd      }| j                  | j                  j                  d      |       | j                  | j                  j                  d      |       y NrA   barrB   rC   s     r   0test_register_with_features_makes_lookup_succeedz=RegistryTest.test_register_with_features_makes_lookup_succeedn   sR    ++E59--e4g>--e4g>r   c                 ~    | j                  dd      }| j                  | j                  j                  d      d        y NrA   rH   bazrB   rC   s     r   4test_lookup_fails_when_no_builder_implements_featurezARegistryTest.test_lookup_fails_when_no_builder_implements_features   s3    ++E59--e4d;r   c                     | j                  d      }| j                  d      }| j                  | j                  j                         |       y rG   rB   r   builder1builder2s      r   Ctest_lookup_gets_most_recent_registration_when_no_feature_specifiedzPRegistryTest.test_lookup_gets_most_recent_registration_when_no_feature_specifiedw   s?    ,,U3,,U3--/:r   c                 X    | j                  | j                  j                         d        y r4   )r   r   r   r   s    r   2test_lookup_fails_when_no_tree_builders_registeredz?RegistryTest.test_lookup_fails_when_no_tree_builders_registered|   s    --/6r   c                    | j                  d      }| j                  d      }| j                  ddd      }| j                  ddd      }| j                  d      }| j                  d      }| j                  | j                  j                  dd      |       | j                  | j                  j                  ddd      |       y )NrA   rH   rL   quuxrB   )r   has_onehas_the_otherhas_both_earlyhas_both_late	lacks_ones         r   <test_lookup_gets_most_recent_builder_supporting_all_featureszIRegistryTest.test_lookup_gets_most_recent_builder_supporting_all_features   s    ++E211%8225%G11%G--e4	11%8 	--eU;'	) 	--eUEB(	*r   c                     | j                  dd      }| j                  dd      }| j                  | j                  j                  dd      d        y rK   rB   rO   s      r   :test_lookup_fails_when_cannot_reconcile_requested_featureszGRegistryTest.test_lookup_fails_when_cannot_reconcile_requested_features   sG    ,,UE:,,UE:--eU;TBr   N)r,   r-   r.   r/   r5   r?   rE   rI   rM   rR   rT   r\   r^   r0   r   r   r2   r2   V   s3    8.	:?
<;
7*"Cr   r2   )r/   unittestr&   bs4r   bs4.builderr   r   r   r   r   r   ImportErrorr   r	   r   TestCaser   r2   r0   r   r   <module>rd      s    $    ,
 L
7:(++ 7:r=C8$$ =CM    Ls"   A 
A' A$#A$'A10A1