Esempio n. 1
0
    def test_url(self):
        uut = Setting("key", "http://google.com")
        self.assertEqual(url(uut), "http://google.com")

        with self.assertRaises(ValueError):
            uut = Setting("key", "abc")
            url(uut)
Esempio n. 2
0
    def test_url(self):
        uut = Setting('key', 'http://google.com')
        self.assertEqual(url(uut), 'http://google.com')

        with self.assertRaises(ValueError):
            uut = Setting('key', 'abc')
            url(uut)
Esempio n. 3
0
    def test_url(self):
        uut = Setting("key", "http://google.com")
        self.assertEqual(url(uut), "http://google.com")

        with self.assertRaises(ValueError):
            uut = Setting("key", "abc")
            url(uut)
Esempio n. 4
0
def path_or_url(xml_dtd):
    """
    Converts the setting value to url or path.

    :param xml_dtd: Setting key.
    :return:        Returns a converted setting value.
    """
    try:
        return url(xml_dtd)
    except ValueError:
        return path(xml_dtd)
Esempio n. 5
0
def path_or_url(xml_dtd):
    '''
    Coverts the setting value to url or path.

    :param xml_dtd: Setting key.
    :return:        Returns a converted setting value.
    '''
    try:
        return url(xml_dtd)
    except ValueError:
        return path(xml_dtd)