MCPcopy Index your code
hub / github.com/csev/py4e / test_basic_namespaces

Method test_basic_namespaces

code3/bs4/testing.py:338–351  ·  view source on GitHub ↗

Parsers don't need to *understand* namespaces, but at the very least they should not choke on namespaces or lose data.

(self)

Source from the content-addressed store, hash-verified

336 self.assertConnectedness(soup.article)
337
338 def test_basic_namespaces(self):
339 """Parsers don't need to *understand* namespaces, but at the
340 very least they should not choke on namespaces or lose
341 data."""
342
343 markup = b'<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg"><head></head><body><mathml:msqrt>4</mathml:msqrt><b svg:fill="red"></b></body></html>'
344 soup = self.soup(markup)
345 self.assertEqual(markup, soup.encode())
346 html = soup.html
347 self.assertEqual('http://www.w3.org/1999/xhtml', soup.html['xmlns'])
348 self.assertEqual(
349 'http://www.w3.org/1998/Math/MathML', soup.html['xmlns:mathml'])
350 self.assertEqual(
351 'http://www.w3.org/2000/svg', soup.html['xmlns:svg'])
352
353 def test_multivalued_attribute_value_becomes_list(self):
354 markup = b'<a class="foo bar">'

Callers

nothing calls this directly

Calls 2

soupMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected