Example #1
0
 def test_set_text(self):
     el = ExternalLink('[ftp://mediawiki.org mediawiki ftp]')
     el.text = 'mwftp'
     self.assertEqual('[ftp://mediawiki.org mwftp]', el.string)
     el = ExternalLink('ftp://mediawiki.org')
     el.text = 'mwftp'
     self.assertEqual('[ftp://mediawiki.org mwftp]', el.string)
def test_text_setter():
    el = ExternalLink('[ftp://mediawiki.org mediawiki ftp]')
    el.text = 'a'
    assert '[ftp://mediawiki.org a]' == el.string

    del el.text
    el.text = 'b'
    assert '[ftp://mediawiki.org b]' == el.string

    el = ExternalLink('ftp://mediawiki.org')
    el.text = 'c'
    assert '[ftp://mediawiki.org c]' == el.string
Example #3
0
    def test_text_setter(self):
        ae = self.assertEqual
        el = ExternalLink('[ftp://mediawiki.org mediawiki ftp]')
        el.text = 'a'
        ae('[ftp://mediawiki.org a]', el.string)

        del el.text
        el.text = 'b'
        ae('[ftp://mediawiki.org b]', el.string)

        el = ExternalLink('ftp://mediawiki.org')
        el.text = 'c'
        ae('[ftp://mediawiki.org c]', el.string)
def test_numberedmailto_change_none_to_empty():
    s = ('[mailto:'
         '[email protected]?Subject=URL%20Encoded%20Subject&body='
         'Body%20Textinfo]')
    el = ExternalLink(s)
    assert s[1:-1] == el.url
    assert el.text is None
    assert el.in_brackets
    el.text = ''
    assert el.string == s[:-1] + ' ]'
Example #5
0
 def test_numberedmailto_change_none_to_empty(self):
     ae = self.assertEqual
     s = ('[mailto:'
          '[email protected]?Subject=URL%20Encoded%20Subject&body='
          'Body%20Textinfo]')
     el = ExternalLink(s)
     ae(s[1:-1], el.url)
     self.assertIsNone(el.text)
     ae(True, el.in_brackets)
     el.text = ''
     ae(el.string, s[:-1] + ' ]')