summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sgmllib.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-09-11 04:24:09 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-09-11 04:24:09 (GMT)
commitbcc119a22ca98facc80e7350b3ffca3335c9d288 (patch)
tree01e60cdc702c9b36dd9cdb437b12a5a349bd3a40 /Lib/test/test_sgmllib.py
parentca2ca79d23645eb2ee457f64506d05f232c673c9 (diff)
downloadcpython-bcc119a22ca98facc80e7350b3ffca3335c9d288.zip
cpython-bcc119a22ca98facc80e7350b3ffca3335c9d288.tar.gz
cpython-bcc119a22ca98facc80e7350b3ffca3335c9d288.tar.bz2
Forward port of 51850 from release25-maint branch.
As mentioned on python-dev, reverting patch #1504333 because it introduced an infinite loop in rev 47154. This patch also adds a test to prevent the regression.
Diffstat (limited to 'Lib/test/test_sgmllib.py')
-rw-r--r--Lib/test/test_sgmllib.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index 28a21a4..b698636 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -286,21 +286,6 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
('codepoint', 'convert', 42),
])
- def test_attr_values_quoted_markup(self):
- """Multi-line and markup in attribute values"""
- self.check_events("""<a title='foo\n<br>bar'>text</a>""",
- [("starttag", "a", [("title", "foo\n<br>bar")]),
- ("data", "text"),
- ("endtag", "a")])
- self.check_events("""<a title='less < than'>text</a>""",
- [("starttag", "a", [("title", "less < than")]),
- ("data", "text"),
- ("endtag", "a")])
- self.check_events("""<a title='greater > than'>text</a>""",
- [("starttag", "a", [("title", "greater > than")]),
- ("data", "text"),
- ("endtag", "a")])
-
def test_attr_funky_names(self):
self.check_events("""<a a.b='v' c:d=v e-f=v>""", [
("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]),
@@ -376,6 +361,19 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
('decl', 'DOCTYPE doc [<!ATTLIST doc attr (a | b) >]'),
])
+ def test_read_chunks(self):
+ # SF bug #1541697, this caused sgml parser to hang
+ # Just verify this code doesn't cause a hang.
+ CHUNK = 1024 # increasing this to 8212 makes the problem go away
+
+ f = open(test_support.findfile('sgml_input.html'))
+ fp = sgmllib.SGMLParser()
+ while 1:
+ data = f.read(CHUNK)
+ fp.feed(data)
+ if len(data) != CHUNK:
+ break
+
# XXX These tests have been disabled by prefixing their names with
# an underscore. The first two exercise outstanding bugs in the
# sgmllib module, and the third exhibits questionable behavior