[Twisted-web] 3 failing tests for Nevow
Valentino Volonghi
dialtone at gmail.com
Sat Jul 3 07:25:18 MDT 2004
I've noticed that Nevow does 3 things wrong when using xmlfile (not
sure if it is also xmlstr though).
It removes the _not_ optional DOCTYPE, the prolog and the _not_
optional xmlns tag about xhtml namespace.
Now I've written 3 failing tests about those 3 problems.
Index: nevow/test/test_loaders.py
===================================================================
--- nevow/test/test_loaders.py (revision 375)
+++ nevow/test/test_loaders.py (working copy)
@@ -227,3 +227,42 @@
result = loaders.xmlstr(doc).load()
# There should be a space between the two slots
self.assertEquals(result[2], ' ')
+
+ def test_missingDOCTYPE(self):
+ doc = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "DTD/xhtml1-strict.dtd"><html><body></body></html>'''
+ result = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "DTD/xhtml1-strict.dtd"><html><body></body></html>'''
+ temp = self.mktemp()
+ f = file(temp, 'w')
+ f.write(doc)
+ f.close()
+ df = loaders.xmlfile(temp)
+ r1 = df.load()
+ self.assertEquals(r1[0], result)
+
+
+ def test_missingxhtmlxmlns(self):
+ doc = '''<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en"
xmlns:nevow="http://nevow.com/ns/nevow/0.1"><body></body></html>'''
+ result = '''<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en"><body></body></html>'''
+ temp = self.mktemp()
+ f = file(temp, 'w')
+ f.write(doc)
+ f.close()
+ df = loaders.xmlfile(temp)
+ r1 = df.load()
+ self.assertEquals(r1[0], result)
+
+ def test_missingprolog(self):
+ """ This is not a real error, because the <? xml... ?> prolog is
+ optional, but it is no good that we have a removed tag from the
+ xhtml right? Also this will make IE6 work in IE5 mode, no good, but
+ we should not hide the magic.
+ """
+ doc = '''<?xml version="1.0"
encoding="UTF-8"?><html><body></body></html>'''
+ result = '''<?xml version="1.0"
encoding="UTF-8"?><html><body></body></html>'''
+ temp = self.mktemp()
+ f = file(temp, 'w')
+ f.write(doc)
+ f.close()
+ df = loaders.xmlfile(temp)
+ r1 = df.load()
+ self.assertEquals(r1[0], result)
More information about the Twisted-web
mailing list