Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Lib/test/test_sax.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import sys
from urllib.error import URLError
import urllib.request
from test.support import os_helper
from test.support import findfile, check__all__
from test.support import (check__all__, cpython_only, findfile,
import_helper, os_helper)
from test.support.os_helper import FakePath, TESTFN


Expand Down Expand Up @@ -1600,6 +1600,12 @@ def test_deprecated__version__and__date__(self):
getattr(module, "version")
self.assertEqual(cm.filename, __file__)

Comment thread
jelly marked this conversation as resolved.
@cpython_only
def test_lazy_import(self):
import_helper.ensure_lazy_imports(
"xml.sax.saxutils", {"urllib.parse", "urllib.request"}
)


if __name__ == "__main__":
unittest.main()
8 changes: 5 additions & 3 deletions Lib/xml/sax/saxutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
convenience of application and driver writers.
"""

import os, urllib.parse, urllib.request
import io
import codecs
import io
import os
import sys
lazy import urllib.parse
lazy import urllib.request
from . import handler
from . import xmlreader

Expand Down Expand Up @@ -70,7 +73,6 @@ def quoteattr(data, entities={}):

def _gettextwriter(out, encoding):
if out is None:
import sys
return sys.stdout

if isinstance(out, io.TextIOBase):
Expand Down
Loading