Mercurial > p > roundup > code
comparison test/test_templating.py @ 4391:d5239335fae3
make URL detection a little smarter about brackets per issue2550657
(thanks Ezio Melotti)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 12 Jul 2010 04:14:02 +0000 |
| parents | ce684080e968 |
| children | 66603a9051f9 |
comparison
equal
deleted
inserted
replaced
| 4390:936bd9bf732d | 4391:d5239335fae3 |
|---|---|
| 145 | 145 |
| 146 def test_url_replace(self): | 146 def test_url_replace(self): |
| 147 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', '') | 147 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', '') |
| 148 def t(s): return p.hyper_re.sub(p._hyper_repl, s) | 148 def t(s): return p.hyper_re.sub(p._hyper_repl, s) |
| 149 ae = self.assertEquals | 149 ae = self.assertEquals |
| 150 ae(t('http://roundup.net/'), '<a href="http://roundup.net/">http://roundup.net/</a>') | |
| 151 ae(t('<HTTP://roundup.net/>'), '<<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>>') | |
| 152 ae(t('<www.roundup.net>'), '<<a href="http://www.roundup.net">www.roundup.net</a>>') | |
| 153 ae(t('item123123123123'), 'item123123123123') | 150 ae(t('item123123123123'), 'item123123123123') |
| 151 ae(t('http://roundup.net/'), | |
| 152 '<a href="http://roundup.net/">http://roundup.net/</a>') | |
| 153 ae(t('<HTTP://roundup.net/>'), | |
| 154 '<<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>>') | |
| 155 ae(t('<www.roundup.net>'), | |
| 156 '<<a href="http://www.roundup.net">www.roundup.net</a>>') | |
| 157 ae(t('(www.roundup.net)'), | |
| 158 '(<a href="http://www.roundup.net">www.roundup.net</a>)') | |
| 159 ae(t('foo http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx bar'), | |
| 160 'foo <a href="http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx">' | |
| 161 'http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx</a> bar') | |
| 162 ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language))'), | |
| 163 '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">' | |
| 164 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>)') | |
| 165 ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language)).'), | |
| 166 '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">' | |
| 167 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>).') | |
| 154 | 168 |
| 155 ''' | 169 ''' |
| 156 class HTMLPermissions: | 170 class HTMLPermissions: |
| 157 def is_edit_ok(self): | 171 def is_edit_ok(self): |
| 158 def is_view_ok(self): | 172 def is_view_ok(self): |
