Fixed #26922 -- Fixed SimpleTestCase.assertHTMLEqual() crash on Python 3.5+.

This commit is contained in:
Dmitry Dygalo 2016-07-20 16:12:13 +02:00 committed by Tim Graham
parent 915786785f
commit d7a097265b
2 changed files with 11 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import unittest
import warnings
@ -629,6 +630,15 @@ class HTMLEqualTests(SimpleTestCase):
self.assertHTMLEqual('<p>', '')
with self.assertRaises(AssertionError):
self.assertHTMLEqual('', '<p>')
error_msg = (
"First argument is not valid HTML:\n"
"('Unexpected end tag `div` (Line 1, Column 6)', (1, 6))"
) if sys.version_info >= (3, 5) else (
"First argument is not valid HTML:\n"
"Unexpected end tag `div` (Line 1, Column 6), at line 1, column 7"
)
with self.assertRaisesMessage(AssertionError, error_msg):
self.assertHTMLEqual('< div></ div>', '<div></div>')
with self.assertRaises(HTMLParseError):
parse_html('</p>')