[Zope-Checkins] CVS: Packages/StructuredText/tests -
testStructuredText.py:1.21.2.2
Andreas Jung
andreas at andreas-jung.com
Sat Apr 9 04:50:53 EDT 2005
Update of /cvs-repository/Packages/StructuredText/tests
In directory cvs.zope.org:/tmp/cvs-serv19711/lib/python/StructuredText/tests
Modified Files:
Tag: Zope-2_7-branch
testStructuredText.py
Log Message:
- Collector #1750: StructuredText: fixed handling of image URLs
with query string
- some more unittests
=== Packages/StructuredText/tests/testStructuredText.py 1.21.2.1 => 1.21.2.2 ===
--- Packages/StructuredText/tests/testStructuredText.py:1.21.2.1 Sun Nov 28 04:40:10 2004
+++ Packages/StructuredText/tests/testStructuredText.py Sat Apr 9 04:50:53 2005
@@ -138,7 +138,7 @@
if not isinstance(stxtxt, UnicodeType):
res = HTML(stxtxt,level=1,header=0)
- if res.find(expected)==-1:
+ if not expected in res:
print "Text: ",stxtxt
print "Converted:",res
print "Expected: ",expected
@@ -148,8 +148,10 @@
ustxtxt = stxtxt
else:
ustxtxt = unicode(stxtxt)
+
res = HTML(ustxtxt,level=1,header=0)
- if res.find(expected)==-1:
+ if not expected in res:
+
print "Text: ",stxtxt.encode('latin-1')
print "Converted:",res.encode('latin-1')
print "Expected: ",expected.encode('latin-1')
@@ -208,6 +210,17 @@
def testLinkInLiteral(self):
self._test("this is a '\"literal\":http://www.zope.org/.' eh",
'<code>"literal":http://www.zope.org/.</code>')
+
+
+ def testLink(self):
+ self._test('"foo":http://www.zope.org/foo/bar',
+ '<p><a href="http://www.zope.org/foo/bar">foo</a></p>')
+
+ self._test('"foo":http://www.zope.org/foo/bar/%20x',
+ '<p><a href="http://www.zope.org/foo/bar/%20x">foo</a></p>')
+
+ self._test('"foo":http://www.zope.org/foo/bar?arg1=1&arg2=2',
+ '<p><a href="http://www.zope.org/foo/bar?arg1=1&arg2=2">foo</a></p>')
def testImgLink(self):
self._test('"foo":img:http://www.zope.org/bar.gif',
@@ -215,6 +228,13 @@
self._test('"foo":img:http://www.zope.org:8080/bar.gif',
'<img src="http://www.zope.org:8080/bar.gif" alt="foo">')
+
+ self._test('"foo":img:http://www.zope.org:8080/foo/bar?arg=1',
+ '<img src="http://www.zope.org:8080/foo/bar?arg=1" alt="foo">')
+
+ self._test('"foo":img:http://www.zope.org:8080/foo/b%20ar?arg=1',
+ '<img src="http://www.zope.org:8080/foo/b%20ar?arg=1" alt="foo">')
+
def XXXtestUnicodeContent(self):
# This fails because ST uses the default locale to get "letters"
More information about the Zope-Checkins
mailing list