コード例 #1
0
    def test_is_valid_url(self):
        bad = 'www.google.com'
        good = 'http://www.google.com'

        self.assertTrue(is_valid_url(good))
        self.assertFalse(is_valid_url(bad))

        s = Shortener('TinyurlShortener')
        with self.assertRaises(ValueError):
            url = 'http://12'
            s.short(url)
コード例 #2
0
    def test_is_valid_url(self):
        bad = 'www.google.com'
        good = 'http://www.google.com'

        self.assertTrue(is_valid_url(good))
        self.assertFalse(is_valid_url(bad))

        s = Shortener('TinyurlShortener')
        with self.assertRaises(ValueError):
            url = 'http://12'
            s.short(url)
コード例 #3
0
ファイル: test_shorteners.py プロジェクト: rasa/pyshorteners
def test_is_valid_url():
    bad = 'www.google.com'
    good = 'http://www.google.com'

    assert is_valid_url(good)
    assert not is_valid_url(bad)

    s = Shortener(Shorteners.TINYURL)
    with pytest.raises(ValueError):
        url = 'http://12'
        s.short(url)

    with pytest.raises(ValueError):
        url = 'www.11.xom'
        s.expand(url)
コード例 #4
0
def test_is_valid_url():
    bad = 'www.google.com'
    good = 'http://www.google.com'

    assert is_valid_url(good)
    assert not is_valid_url(bad)

    s = Shortener('TinyurlShortener')
    with pytest.raises(ValueError):
        url = 'http://12'
        s.short(url)


    with pytest.raises(ValueError):
        url = 'www.11.xom'
        s.expand(url)