示例#1
0
 def test_base(self):
     res = absolute_system_id('http://www.xml.com')
     self.assertEquals(res, 'http://www.xml.com')
     
     res = absolute_system_id('http://www.xml.com', 'http://whatever')
     self.assertEquals(res, 'http://www.xml.com')
     
     res = absolute_system_id('quotes.xml')
     self.assertEquals(res, 'file://%s' % join(TEST_DIR, 'quotes.xml'))
示例#2
0
    def test_base(self):
        res = absolute_system_id('http://www.xml.com')
        self.assertEquals(res, 'http://www.xml.com')

        res = absolute_system_id('http://www.xml.com', 'http://whatever')
        self.assertEquals(res, 'http://www.xml.com')

        res = absolute_system_id('quotes.xml')
        self.assertEquals(res, 'file://%s' % join(TEST_DIR, 'quotes.xml'))
示例#3
0
 def test_relative(self):
     # FIXME: empty authority // added by MakeUrlLibSafe (actually by
     # urlunsplit), which is probably acceptable since the sysid is designed
     # to be used by urlopen
     
     res = absolute_system_id('quotes.xml', 'file:%s' % TEST_DIR)
     self.assertEquals(res, 'file://%squotes.xml' % TEST_DIR)
     
     res = absolute_system_id('relative.xml', 'file:/base')
     self.assertEquals(res, 'file:///relative.xml')
     
     res = absolute_system_id('relative.xml', 'file:/base/')
     self.assertEquals(res, 'file:///base/relative.xml') 
     
     res = absolute_system_id('file:relative.xml', 'file:/base')
     self.assertEquals(res, 'file:///relative.xml')
示例#4
0
    def test_relative(self):
        # FIXME: empty authority // added by MakeUrlLibSafe (actually by
        # urlunsplit), which is probably acceptable since the sysid is designed
        # to be used by urlopen

        res = absolute_system_id('quotes.xml', 'file:%s' % TEST_DIR)
        self.assertEquals(res, 'file://%squotes.xml' % TEST_DIR)

        res = absolute_system_id('relative.xml', 'file:/base')
        self.assertEquals(res, 'file:///relative.xml')

        res = absolute_system_id('relative.xml', 'file:/base/')
        self.assertEquals(res, 'file:///base/relative.xml')

        res = absolute_system_id('file:relative.xml', 'file:/base')
        self.assertEquals(res, 'file:///relative.xml')