Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/build/test/test_is_url.py
4052 views
1
# -*- coding: utf-8 -*-
2
"""
3
Test the is_url utility
4
"""
5
6
# ****************************************************************************
7
# Copyright (C) 2016 Volker Braun <[email protected]>
8
#
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 2 of the License, or
12
# (at your option) any later version.
13
# https://www.gnu.org/licenses/
14
# ****************************************************************************
15
16
17
import unittest
18
19
from sage_bootstrap.util import is_url
20
21
22
class IsUrlTestCase(unittest.TestCase):
23
24
def test_http(self):
25
self.assertTrue(is_url('http://foo.bar/baz'))
26
27
def test_https(self):
28
self.assertTrue(is_url('https://foo.bar/baz'))
29
30
def test_ftp(self):
31
self.assertTrue(is_url('ftp://foo.bar/baz'))
32
33
def test_nospace(self):
34
self.assertFalse(is_url('http://foo. bar/baz'))
35
36
def test_single_line(self):
37
self.assertFalse(is_url('http://foo.bar/baz\nhttp://foo.bar/baz'))
38
39