def test_multiple_files(self): """ Test validation of multiple files. """ self.assertListEqual( validate(["test_no_errors.html", "test_basic_errors.html"]), broken_file_errors)
def test_error_string_with_quotes(self): """ Test a file with errors containing colon, to make sure it doesn't mess up parsing. """ self.assertEqual(len(validate("test_basic_errors_with_colon.html")), 3)
def test_basic_errors(self): """ Test a file with some errors. """ self.assertListEqual(validate(["test_basic_errors.html"]), broken_file_errors)
def test_missing_file_exception(self): """ Test validation of a missing file (exception). """ self.assertRaises(MissingHtmlFile, lambda: validate("not_exist.html"))
def test_ok_file(self): """ Test validation of file with no errors. """ self.assertListEqual(validate("test_no_errors.html"), [])
def test_validate_bad_html_document_with_filter(self): errors = validate('http://blog.tjll.net/ssh-kung-fu/', error_ignore_regex=re.compile(u"(Bad value “only screen|“&” did not start a character reference|Element “(a|li)” not allowed|The “itemprop” attribute was specified).*", re.DOTALL)) self.assertEquals(len(errors), 0)
def test_validate_bad_html_document(self): errors = validate('http://blog.tjll.net/ssh-kung-fu/') self.assertGreater(len(errors), 0)
def test_validate_good_html_document(self): errors = validate('http://www.ibooksmart.com') self.assertEquals(len(errors), 0)