comparison test/test_templating.py @ 6638:e1588ae185dc issue2550923_computed_property

merge from default branch. Fix travis.ci so CI builds don't error out
author John Rouillard <rouilj@ieee.org>
date Thu, 21 Apr 2022 16:54:17 -0400
parents 21c7c2041a4b
children 5b71a50e833b
comparison
equal deleted inserted replaced
6508:85db90cc1705 6638:e1588ae185dc
420 for g in groups: 420 for g in groups:
421 self.assertEqual(d[g], groups[g], '%s %r != %r in %r'%(g, d[g], 421 self.assertEqual(d[g], groups[g], '%s %r != %r in %r'%(g, d[g],
422 groups[g], s)) 422 groups[g], s))
423 423
424 #t('123.321.123.321', 'url') 424 #t('123.321.123.321', 'url')
425 t('https://example.com/demo/issue8#24MRV9BZYx:V:1B~sssssssssssssss~4~4', url="https://example.com/demo/issue8#24MRV9BZYx:V:1B~sssssssssssssss~4~4")
425 t('http://localhost/', url='http://localhost/') 426 t('http://localhost/', url='http://localhost/')
426 t('http://roundup.net/', url='http://roundup.net/') 427 t('http://roundup.net/', url='http://roundup.net/')
427 t('http://richard@localhost/', url='http://richard@localhost/') 428 t('http://richard@localhost/', url='http://richard@localhost/')
428 t('http://richard:sekrit@localhost/', 429 t('http://richard:sekrit@localhost/',
429 url='http://richard:sekrit@localhost/') 430 url='http://richard:sekrit@localhost/')
437 t('www.foo.net', url='www.foo.net') 438 t('www.foo.net', url='www.foo.net')
438 t('richard@com.example', email='richard@com.example') 439 t('richard@com.example', email='richard@com.example')
439 t('r@a.com', email='r@a.com') 440 t('r@a.com', email='r@a.com')
440 t('i1', **{'class':'i', 'id':'1'}) 441 t('i1', **{'class':'i', 'id':'1'})
441 t('item123', **{'class':'item', 'id':'123'}) 442 t('item123', **{'class':'item', 'id':'123'})
443 t('item 123', **{'class':'item', 'id':'123'})
442 t('www.user:pass@host.net', email='pass@host.net') 444 t('www.user:pass@host.net', email='pass@host.net')
443 t('user:pass@www.host.net', url='user:pass@www.host.net') 445 t('user:pass@www.host.net', url='user:pass@www.host.net')
444 t('123.35', nothing=True) 446 t('123.35', nothing=True)
445 t('-.3535', nothing=True) 447 t('-.3535', nothing=True)
446 448
447 def test_url_replace(self): 449 def test_url_replace(self):
448 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', '') 450 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', '')
449 def t(s): return p.hyper_re.sub(p._hyper_repl, s) 451 def t(s): return p.hyper_re.sub(p._hyper_repl, s)
450 ae = self.assertEqual 452 ae = self.assertEqual
453 ae(t('issue5#msg10'), '<a href="issue5#msg10">issue5#msg10</a>')
454 ae(t('issue5'), '<a href="issue5">issue5</a>')
455 ae(t('issue2255'), 'issue2255')
456 ae(t('foo https://example.com/demo/issue8#24MRV9BZYx:V:1B~sssssssssssssss~4~4 bar'),
457 'foo <a href="https://example.com/demo/issue8#24MRV9BZYx:V:1B~sssssssssssssss~4~4" rel="nofollow noopener">'
458 'https://example.com/demo/issue8#24MRV9BZYx:V:1B~sssssssssssssss~4~4</a> bar')
451 ae(t('item123123123123'), 'item123123123123') 459 ae(t('item123123123123'), 'item123123123123')
452 ae(t('http://roundup.net/'), 460 ae(t('http://roundup.net/'),
453 '<a href="http://roundup.net/" rel="nofollow noopener">http://roundup.net/</a>') 461 '<a href="http://roundup.net/" rel="nofollow noopener">http://roundup.net/</a>')
454 ae(t('&lt;HTTP://roundup.net/&gt;'), 462 ae(t('&lt;HTTP://roundup.net/&gt;'),
455 '&lt;<a href="HTTP://roundup.net/" rel="nofollow noopener">HTTP://roundup.net/</a>&gt;') 463 '&lt;<a href="HTTP://roundup.net/" rel="nofollow noopener">HTTP://roundup.net/</a>&gt;')
476 'http://en.wikipedia.org/wiki/Python_(programming_language</a>&gt;)).') 484 'http://en.wikipedia.org/wiki/Python_(programming_language</a>&gt;)).')
477 for c in '.,;:!': 485 for c in '.,;:!':
478 # trailing punctuation is not included 486 # trailing punctuation is not included
479 ae(t('http://roundup.net/%c ' % c), 487 ae(t('http://roundup.net/%c ' % c),
480 '<a href="http://roundup.net/" rel="nofollow noopener">http://roundup.net/</a>%c ' % c) 488 '<a href="http://roundup.net/" rel="nofollow noopener">http://roundup.net/</a>%c ' % c)
489 # trailing punctuation is not included without trailing space
490 ae(t('http://roundup.net/%c' % c),
491 '<a href="http://roundup.net/" rel="nofollow noopener">http://roundup.net/</a>%c' % c)
481 # but it's included if it's part of the URL 492 # but it's included if it's part of the URL
482 ae(t('http://roundup.net/%c/' % c), 493 ae(t('http://roundup.net/%c/' % c),
483 '<a href="http://roundup.net/%c/" rel="nofollow noopener">http://roundup.net/%c/</a>' % (c, c)) 494 '<a href="http://roundup.net/%c/" rel="nofollow noopener">http://roundup.net/%c/</a>' % (c, c))
495 # including with a non / terminated path
496 ae(t('http://roundup.net/test%c ' % c),
497 '<a href="http://roundup.net/test" rel="nofollow noopener">http://roundup.net/test</a>%c ' % c)
498 # but it's included if it's part of the URL path
499 ae(t('http://roundup.net/%ctest' % c),
500 '<a href="http://roundup.net/%ctest" rel="nofollow noopener">http://roundup.net/%ctest</a>' % (c, c))
501
484 502
485 def test_input_html4(self): 503 def test_input_html4(self):
486 # boolean attributes are just the attribute name 504 # boolean attributes are just the attribute name
487 # indicate with attr=None or attr="attr" 505 # indicate with attr=None or attr="attr"
488 # e.g. disabled 506 # e.g. disabled

Roundup Issue Tracker: http://roundup-tracker.org/