1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
U
¡ý°d4ã@sHddlZddlmZddlmZmZmZddlmZGdd„deƒZ    dS)éN)ÚTag)Ú    FormatterÚ HTMLFormatterÚ XMLFormatteré)ÚSoupTestc @s\eZdZdd„Zdd„Zdd„Zej ddd    d
d d d dde    ƒdfdg
¡dd„ƒZ
dd„Z dS)Ú TestFormattercCs`tƒ}tdd}d|d<d|d<ddg| |¡ks6t‚d|_g| |¡ksNt‚d    |jks\t‚dS)
NÚtag)ÚnamerÚbéÚa)r r )r rú )rrÚ
attributesÚAssertionErrorÚattrsÚindent)ÚselfÚ    formatterr    ©rúOd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\bs4/tests/test_formatter.pyÚtest_default_attributes s
z%TestFormatter.test_default_attributescCsLGdd„dtƒ}| d¡}|ƒ}|j|d}|j|jks<t‚d|ksHt‚dS)Nc@seZdZdd„ZdS)z=TestFormatter.test_sort_attributes.<locals>.UnsortedFormattercss6||_t|j ¡ƒD]\}}|dkr&q||fVqdS)NÚignore)Ú called_withÚsortedrÚitems)rr    ÚkÚvrrrr$s
zHTestFormatter.test_sort_attributes.<locals>.UnsortedFormatter.attributesN)Ú__name__Ú
__module__Ú __qualname__rrrrrÚUnsortedFormatter#sr!z*<p cval="1" aval="2" ignore="ignored"></p>©rz<p aval="2" cval="1"></p>)rÚsoupÚdecoderÚpr)rr!r#rÚdecodedrrrÚtest_sort_attributes s 
 z"TestFormatter.test_sort_attributescCs¸dD]}tj|}d|jkst‚qtjd}d|jks:t‚tjd}d|jksRt‚tdd}d|jksjt‚dD]D}| |¡}dD]0}d|jjd    d
ksšt‚d |jjdd
ks€t‚q€qndS) N)ÚhtmlÚminimalNFÚhtml5T)Úempty_attributes_are_booleans)z<option selected></option>z<option selected=""></option>)r(r)ÚxmlNs<option selected=""></option>r(r"s<option selected></option>)    rZREGISTRYr+rrrr#ÚoptionÚencode)rr
rZmarkupr#rrrÚ"test_empty_attributes_are_booleans4s
 
 
 
 
z0TestFormatter.test_empty_attributes_are_booleansz indent,expect)Nú<a>
<b>
text
</b>
</a>
)éÿÿÿÿr0)rr0)Úr0)rú<a>
 <b>
  text
 </b>
</a>
)r z<a>
  <b>
    text
  </b>
</a>
)ú    z<a>
    <b>
        text
    </b>
</a>
)Úabcz#<a>
abc<b>
abcabctext
abc</b>
</a>
r3)sbytesr3cCs@| d¡}t|d}|j|d|ks(t‚|j|d|ks<t‚dS)Nz<a><b>text</b></a>)rr")r#rZprettifyrr.)rrÚexpectr#rrrrÚ test_indentPs
 
zTestFormatter.test_indentcCstƒ}|jdkst‚dS)Nr)rrr)rrrrrÚtest_default_indent_valuensz'TestFormatter.test_default_indent_valueN) rrr rr'r/ÚpytestÚmarkZ parametrizeÚobjectr7r8rrrrr s&òþ
r)
r9Z bs4.elementrZ bs4.formatterrrrr2rrrrrrÚ<module>s