You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.4 KiB
68 lines
2.4 KiB
11 years ago
|
=== modified file 'bs4/testing.py'
|
||
|
--- bs4/testing.py 2013-05-07 12:19:02 +0000
|
||
|
+++ bs4/testing.py 2013-05-20 13:19:16 +0000
|
||
|
@@ -464,6 +464,18 @@
|
||
|
self.assertEqual(
|
||
|
soup.encode("utf-8"), markup)
|
||
|
|
||
|
+ def test_formatter_processes_script_tag_for_xml_documents(self):
|
||
|
+ doc = """
|
||
|
+ <script type="text/javascript">
|
||
|
+ </script>
|
||
|
+"""
|
||
|
+ soup = BeautifulSoup(doc, "xml")
|
||
|
+ # lxml would have stripped this while parsing, but we can add
|
||
|
+ # it later.
|
||
|
+ soup.script.string = 'console.log("< < hey > > ");'
|
||
|
+ encoded = soup.encode()
|
||
|
+ self.assertTrue(b"< < hey > >" in encoded)
|
||
|
+
|
||
|
def test_popping_namespaced_tag(self):
|
||
|
markup = '<rss xmlns:dc="foo"><dc:creator>b</dc:creator><dc:date>2012-07-02T20:33:42Z</dc:date><dc:rights>c</dc:rights><image>d</image></rss>'
|
||
|
soup = self.soup(markup)
|
||
|
|
||
|
=== modified file 'bs4/tests/test_lxml.py'
|
||
|
--- bs4/tests/test_lxml.py 2013-05-09 19:36:30 +0000
|
||
|
+++ bs4/tests/test_lxml.py 2013-05-20 13:19:16 +0000
|
||
|
@@ -10,6 +10,7 @@
|
||
|
LXML_VERSION = lxml.etree.LXML_VERSION
|
||
|
except ImportError, e:
|
||
|
LXML_PRESENT = False
|
||
|
+ LXML_VERSION = (0,)
|
||
|
|
||
|
from bs4 import (
|
||
|
BeautifulSoup,
|
||
|
@@ -47,7 +48,7 @@
|
||
|
# test if an old version of lxml is installed.
|
||
|
|
||
|
@skipIf(
|
||
|
- LXML_VERSION < (2,3,5,0),
|
||
|
+ not LXML_PRESENT or LXML_VERSION < (2,3,5,0),
|
||
|
"Skipping doctype test for old version of lxml to avoid segfault.")
|
||
|
def test_empty_doctype(self):
|
||
|
soup = self.soup("<!DOCTYPE>")
|
||
|
|
||
|
=== modified file 'bs4/tests/test_tree.py'
|
||
|
--- bs4/tests/test_tree.py 2013-05-14 12:39:16 +0000
|
||
|
+++ bs4/tests/test_tree.py 2013-05-20 13:19:16 +0000
|
||
|
@@ -1344,18 +1344,6 @@
|
||
|
encoded = BeautifulSoup(doc).encode()
|
||
|
self.assertTrue(b"< < hey > >" in encoded)
|
||
|
|
||
|
- def test_formatter_processes_script_tag_for_xml_documents(self):
|
||
|
- doc = """
|
||
|
- <script type="text/javascript">
|
||
|
- </script>
|
||
|
-"""
|
||
|
- soup = BeautifulSoup(doc, "xml")
|
||
|
- # lxml would have stripped this while parsing, but we can add
|
||
|
- # it later.
|
||
|
- soup.script.string = 'console.log("< < hey > > ");'
|
||
|
- encoded = soup.encode()
|
||
|
- self.assertTrue(b"< < hey > >" in encoded)
|
||
|
-
|
||
|
def test_prettify_leaves_preformatted_text_alone(self):
|
||
|
soup = self.soup("<div> foo <pre> \tbar\n \n </pre> baz ")
|
||
|
# Everything outside the <pre> tag is reformatted, but everything
|
||
|
|