summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_htmlparser.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2022-08-18 11:16:33 (GMT)
committerGitHub <noreply@github.com>2022-08-18 11:16:33 (GMT)
commit157aef79b07e07bf115e49cdf5ff25e74c66354e (patch)
tree31d1f5f372a024cc8f018802746d8eaf17659ad4 /Lib/test/test_htmlparser.py
parentc5bc67b2a17d9053be9d0079eb7de948626d33c3 (diff)
downloadcpython-157aef79b07e07bf115e49cdf5ff25e74c66354e.zip
cpython-157aef79b07e07bf115e49cdf5ff25e74c66354e.tar.gz
cpython-157aef79b07e07bf115e49cdf5ff25e74c66354e.tar.bz2
gh-95813: Improve HTMLParser from the view of inheritance (#95874)
* gh-95813: Improve HTMLParser from the view of inheritance * gh-95813: Add unittest * Address code review
Diffstat (limited to 'Lib/test/test_htmlparser.py')
-rw-r--r--Lib/test/test_htmlparser.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index 1291775..b42a611 100644
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -4,6 +4,8 @@ import html.parser
import pprint
import unittest
+from unittest.mock import patch
+
class EventCollector(html.parser.HTMLParser):
@@ -787,5 +789,17 @@ class AttributesTestCase(TestCaseBase):
('starttag', 'form',
[('action', 'bogus|&#()value')])])
+
+class TestInheritance(unittest.TestCase):
+
+ @patch("_markupbase.ParserBase.__init__")
+ @patch("_markupbase.ParserBase.reset")
+ def test_base_class_methods_called(self, super_reset_method, super_init_method):
+ with patch('_markupbase.ParserBase') as parser_base:
+ EventCollector()
+ super_init_method.assert_called_once()
+ super_reset_method.assert_called_once()
+
+
if __name__ == "__main__":
unittest.main()