summaryrefslogtreecommitdiff
path: root/bs4/testing.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2016-07-30 07:55:09 -0400
committerLeonard Richardson <leonardr@segfault.org>2016-07-30 07:55:09 -0400
commit0fe84d4d409273b6fadefe85e328e569b3296cfe (patch)
tree8c1a1d3e52c078c0daff87f7ae2a5e4b77a2fcc5 /bs4/testing.py
parenta15e40b89282ef6924873e41bb08be2eb440880f (diff)
Explained why we test both unicode and bytestring processing instructions.
Diffstat (limited to 'bs4/testing.py')
-rw-r--r--bs4/testing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bs4/testing.py b/bs4/testing.py
index 387f775..3a6ed42 100644
--- a/bs4/testing.py
+++ b/bs4/testing.py
@@ -139,6 +139,14 @@ class HTMLTreeBuilderSmokeTest(object):
markup.replace(b"\n", b""))
def test_processing_instruction(self):
+ # We test both Unicode and bytestring to verify that
+ # process_markup correctly sets processing_instruction_class
+ # even when the markup is already Unicode and there is no
+ # need to process anything.
+ markup = u"""<?PITarget PIContent?>"""
+ soup = self.soup(markup)
+ self.assertEqual(markup, soup.decode())
+
markup = b"""<?PITarget PIContent?>"""
soup = self.soup(markup)
self.assertEqual(markup, soup.encode("utf8"))