bpo-34789: make xml.sax.make_parser accept iterables of all types (GH-9576)

This commit is contained in:
Andrés Delfino 2018-10-26 11:56:57 -03:00 committed by Tal Einat
parent 10cb3760e8
commit a6dc531063
4 changed files with 38 additions and 5 deletions

View file

@ -254,6 +254,34 @@ class MakeParserTest(unittest.TestCase):
from xml.sax import make_parser
p = make_parser()
def test_make_parser3(self):
# Testing that make_parser can handle different types of
# iterables.
make_parser(['module'])
make_parser(('module', ))
make_parser({'module'})
make_parser(frozenset({'module'}))
make_parser({'module': None})
make_parser(iter(['module']))
def test_make_parser4(self):
# Testing that make_parser can handle empty iterables.
make_parser([])
make_parser(tuple())
make_parser(set())
make_parser(frozenset())
make_parser({})
make_parser(iter([]))
def test_make_parser5(self):
# Testing that make_parser can handle iterables with more than
# one item.
make_parser(['module1', 'module2'])
make_parser(('module1', 'module2'))
make_parser({'module1', 'module2'})
make_parser(frozenset({'module1', 'module2'}))
make_parser({'module1': None, 'module2': None})
make_parser(iter(['module1', 'module2']))
# ===========================================================================
#