def test_validate_url(self):
        for url, is_valid in [
            ("", False), ("invalid", False), ("/invalid", False), ("http://localhost:", False),
            ("http://localhost:/invalid", False), ("://localhost/invalid", False),
            ("http://localhost", True), ("http://localhost/test", True),
            ("http://localhost:8080", True), ("http://localhost:8080/test", True),
            ("http://user:pass@localhost/test", True), ("http://user:pass@localhost:8080/test", True)
        ]:
            returned_val = PageObject.validate_url(url)
            self.assertEquals(returned_val, is_valid, msg="Url: {0}, Expected {1} but got {2}".format(url, is_valid, returned_val))
Check error handling for malformed url.
dataset/ETHPy150Open edx/bok-choy/tests/test_page_object.py/PageObjectTest.test_validate_url