Commit 67b5488d authored by Andreas Jung's avatar Andreas Jung

some more tests for links and links with images

parent b6600112
...@@ -27,7 +27,7 @@ class DocumentWithImages(DocumentClass): ...@@ -27,7 +27,7 @@ class DocumentWithImages(DocumentClass):
def doc_img( def doc_img(
self, s, self, s,
expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9%\_\-.:/\?=;,\n\~]+)').search, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\[\]\'\-\n\~]+)\":img:([a-zA-Z0-9%\_\-.:/\?=;,\n\~]+)').search,
): ):
......
...@@ -212,6 +212,16 @@ class BasicTests(unittest.TestCase): ...@@ -212,6 +212,16 @@ class BasicTests(unittest.TestCase):
self._test('"foo":http://www.zope.org/foo/bar?arg1=1&arg2=2', 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>') '<p><a href="http://www.zope.org/foo/bar?arg1=1&arg2=2">foo</a></p>')
self._test('"foo bar":http://www.zope.org/foo/bar',
'<p><a href="http://www.zope.org/foo/bar">foo bar</a></p>')
self._test('"[link goes here]":http://www.zope.org/foo/bar',
'<p><a href="http://www.zope.org/foo/bar">[link goes here]</a></p>')
self._test('"[Dad\'s car]":http://www.zope.org/foo/bar',
'<p><a href="http://www.zope.org/foo/bar">[Dad\'s car]</a></p>')
def testImgLink(self): def testImgLink(self):
self._test('"foo":img:http://www.zope.org/bar.gif', self._test('"foo":img:http://www.zope.org/bar.gif',
'<img src="http://www.zope.org/bar.gif" alt="foo" />') '<img src="http://www.zope.org/bar.gif" alt="foo" />')
...@@ -225,6 +235,14 @@ class BasicTests(unittest.TestCase): ...@@ -225,6 +235,14 @@ class BasicTests(unittest.TestCase):
self._test('"foo":img:http://www.zope.org:8080/foo/b%20ar?arg=1', 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" />') '<img src="http://www.zope.org:8080/foo/b%20ar?arg=1" alt="foo" />')
self._test('"foo bar":img:http://www.zope.org:8080/foo/bar',
'<img src="http://www.zope.org:8080/foo/bar" alt="foo bar" />')
self._test('"[link goes here]":img:http://www.zope.org:8080/foo/bar',
'<img src="http://www.zope.org:8080/foo/bar" alt="[link goes here]" />')
self._test('"[Dad\'s new car]":img:http://www.zope.org:8080/foo/bar',
'<img src="http://www.zope.org:8080/foo/bar" alt="[Dad\'s new car]" />')
def XXXtestUnicodeContent(self): def XXXtestUnicodeContent(self):
# This fails because ST uses the default locale to get "letters" # This fails because ST uses the default locale to get "letters"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment