summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrés Delfino <adelfino@gmail.com>2018-10-26 14:56:57 (GMT)
committerTal Einat <taleinat+github@gmail.com>2018-10-26 14:56:57 (GMT)
commita6dc531063efe3a8d47ff4639729060c72a3688c (patch)
tree25f8f3c4a7883783103a4c6d73ee117aa50dc187 /Lib/test
parent10cb3760e8631a27f5db1e51b05494e29306c671 (diff)
downloadcpython-a6dc531063efe3a8d47ff4639729060c72a3688c.zip
cpython-a6dc531063efe3a8d47ff4639729060c72a3688c.tar.gz
cpython-a6dc531063efe3a8d47ff4639729060c72a3688c.tar.bz2
bpo-34789: make xml.sax.make_parser accept iterables of all types (GH-9576)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_sax.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 3044960..894d86a 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -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']))
# ===========================================================================
#