Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
cT @ s d Z ddlZddlZddlmZ ddlmZmZm Z yddlm
Z
dZW n ek
r` dZY nX yddlm
Z
mZ dZW n ek
r dZY nX G d d
d
ejZG dd dejZdS )
zTests of the builder registry. N)
BeautifulSoup)builder_registryHTMLParserTreeBuilderTreeBuilderRegistry)HTML5TreeBuilderTF)LXMLTreeBuilderForXMLLXMLTreeBuilderc @ s0 e Zd ZdZdd Zdd Zdd Zdd Zd
S )BuiltInRegistryTestz@Test the built-in registry with the default builders registered.c C s` t r| jtjddt t r0| jtjddt | jtjddt tr\| jtjddt d S )NfasthtmlZ
permissivexmlstricthtml5lib) LXML_PRESENTassertEqualregistrylookupr r r HTML5LIB_PRESENTr )self r +/usr/lib/python3.6/test_builder_registry.pytest_combination s z$BuiltInRegistryTest.test_combinationc C sj t r*| jtjdt | jtjdt n<| jtjdd trT| jtjdt n| jtjdt d S )Nr r ) r r r r r r r r r )r r r r test_lookup_by_markup_type. s z.BuiltInRegistryTest.test_lookup_by_markup_typec C sX t r,| jtjddt | jtjddt trB| jtjdt | jtjdt d S )NZlxmlr r r zhtml.parser) r r r r r r r r r )r r r r test_named_library9 s z&BuiltInRegistryTest.test_named_libraryc
C sJ t jdd"}tddd tdddgd W d Q R X | jttddd d S )NT)record r )featuresr
zno-such-feature)warningscatch_warningsr ZassertRaises
ValueError)r wr r r *test_beautifulsoup_constructor_does_lookupF s
z>BuiltInRegistryTest.test_beautifulsoup_constructor_does_lookupN)__name__
__module____qualname____doc__r r r r! r r r r r s
r c @ sX e Zd ZdZdd Zdd Zdd Zdd Zd
d Zdd
Z dd Z
dd Zdd ZdS )RegistryTestz.Test the TreeBuilderRegistry class in general.c C s t | _d S )N)r r )r r r r setUpY s zRegistryTest.setUpc G s, t ddj| tfd|i}| jj| |S )NZBuilder__r )typejoinobjectr register)r Zfeature_listclsr r r builder_for_features\ s z!RegistryTest.builder_for_featuresc C s2 | j }| j| jjdd | j| jj | d S )Nfoo)r. r r r )r builderr r r test_register_with_no_featuresc s z+RegistryTest.test_register_with_no_featuresc C s8 | j dd}| j| jjd| | j| jjd| d S )Nr/ bar)r. r r r )r r0 r r r 0test_register_with_features_makes_lookup_succeedn s z=RegistryTest.test_register_with_features_makes_lookup_succeedc C s$ | j dd}| j| jjdd d S )Nr/ r2 baz)r. r r r )r r0 r r r 4test_lookup_fails_when_no_builder_implements_features s zARegistryTest.test_lookup_fails_when_no_builder_implements_featurec C s* | j d}| j d}| j| jj | d S )Nr/ r2 )r. r r r )r builder1builder2r r r Ctest_lookup_gets_most_recent_registration_when_no_feature_specifiedw s
zPRegistryTest.test_lookup_gets_most_recent_registration_when_no_feature_specifiedc C s | j | jj d d S )N)r r r )r r r r 2test_lookup_fails_when_no_tree_builders_registered| s z?RegistryTest.test_lookup_fails_when_no_tree_builders_registeredc C sv | j d}| j d}| j ddd}| j ddd}| j d}| j d}| j| jjdd| | j| jjddd| d S )Nr/ r2 r4 Zquux)r. r r r )r Zhas_oneZ
has_the_otherZhas_both_earlyZ
has_both_lateZ lacks_oner r r