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'))
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')