993
995
result = http.unhtml_roughly(fake_html)
994
996
self.assertEquals(len(result), 1000)
995
997
self.assertStartsWith(result, " something!")
1000
class SomeDirectory(object):
1002
def look_up(self, name, url):
1006
class TestLocationToUrl(tests.TestCase):
1008
def test_regular_url(self):
1009
self.assertEquals("file://foo", location_to_url("file://foo"))
1011
def test_directory(self):
1012
directories.register("bar:", SomeDirectory, "Dummy directory")
1013
self.addCleanup(directories.remove, "bar:")
1014
self.assertEquals("http://bar", location_to_url("bar:"))
1016
def test_unicode_url(self):
1017
self.assertRaises(errors.InvalidURL, location_to_url,
1018
"http://fo/\xc3\xaf".decode("utf-8"))
1020
def test_unicode_path(self):
1021
self.assertEquals("file:///foo/bar%C3%AF",
1022
location_to_url("/foo/bar\xc3\xaf".decode("utf-8")))
1024
def test_path(self):
1025
self.assertEquals("file:///foo/bar", location_to_url("/foo/bar"))