示例#1
0
文件: tests.py 项目: the9000/stelm
 def testBadCharsInUrl(self):
   s = ur'abc http://d.e.f?<a>+"b"|foo ghi'
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc <a href="http://d.e.f?&lt;a&gt;+&quot;b&quot;">foo</a>')
   self.assertEqual(next, s.index(" ghi"))
示例#2
0
文件: tests.py 项目: the9000/stelm
 def testInnerParens(self):
   s = ur"abc http://wiki/Foo_(Bar) ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc <a href="http://wiki/Foo_(Bar)">http://wiki/Foo_(Bar)</a>')
   self.assertEqual(next, s.index(" ghi"))
示例#3
0
文件: tests.py 项目: the9000/stelm
 def testUnknownProtocolClass(self):
   s = ur"abc zox://wiki/Foo ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc <a href="zox://wiki/Foo" class="unknown">zox://wiki/Foo</a>')
   self.assertEqual(next, s.index(" ghi"))
示例#4
0
文件: tests.py 项目: the9000/stelm
 def testPunctuationAndName(self):
   s = ur"abc http://d.e.f?ghi!|foo. ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc <a href="http://d.e.f?ghi!">foo.</a>')
   self.assertEqual(next, s.index(" ghi"))
示例#5
0
文件: tests.py 项目: the9000/stelm
 def testOuterParensAndDot(self):
   s = ur"abc (http://d.e.f). ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc (<a href="http://d.e.f">http://d.e.f</a>')
   self.assertEqual(next, s.index("). ghi"))
示例#6
0
文件: tests.py 项目: the9000/stelm
 def testComma(self):
   s = ur"abc http://d.e.f, ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertEqual(u"".join(frags), u'abc <a href="http://d.e.f">http://d.e.f</a>')
   self.assertEqual(next, s.index(", ghi"))
示例#7
0
文件: tests.py 项目: the9000/stelm
 def testNamedEscaped(self):
   s = ur'abc http://d.e.f|"D\"E\"F" ghi'
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertTrue(u"".join(frags).startswith(u'abc <a href="http://d.e.f">D"E"F</a>'))
   self.assertEqual(next, s.index(" ghi"))
示例#8
0
文件: tests.py 项目: the9000/stelm
 def testNamed(self):
   s = ur"abc http://d.e.f|DEF ghi"
   f = Linker(s, 0)
   frags, next = f.apply()
   self.assertTrue(u"".join(frags).startswith(u'abc <a href="http://d.e.f">DEF</a>'))
   self.assertEqual(next, s.index(" ghi"))