mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-120417: Fix "imported but unused" linter warnings (#120461)
Add __all__ to the following modules: importlib.machinery, importlib.util and xml.sax. Add also "# noqa: F401" in collections.abc, subprocess and xml.sax. * Sort __all__; remove collections.abc.__all__; remove private names * Add tests
This commit is contained in:
parent
ed60ab5fab
commit
05df063ad8
7 changed files with 84 additions and 8 deletions
|
@ -16,6 +16,7 @@ from xml.sax.expatreader import create_parser
|
|||
from xml.sax.handler import (feature_namespaces, feature_external_ges,
|
||||
LexicalHandler)
|
||||
from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
|
||||
from xml import sax
|
||||
from io import BytesIO, StringIO
|
||||
import codecs
|
||||
import os.path
|
||||
|
@ -25,7 +26,7 @@ import sys
|
|||
from urllib.error import URLError
|
||||
import urllib.request
|
||||
from test.support import os_helper
|
||||
from test.support import findfile
|
||||
from test.support import findfile, check__all__
|
||||
from test.support.os_helper import FakePath, TESTFN
|
||||
|
||||
|
||||
|
@ -1557,5 +1558,20 @@ class CDATAHandlerTest(unittest.TestCase):
|
|||
self.assertEqual(self.char_index, 2)
|
||||
|
||||
|
||||
class TestModuleAll(unittest.TestCase):
|
||||
def test_all(self):
|
||||
extra = (
|
||||
'ContentHandler',
|
||||
'ErrorHandler',
|
||||
'InputSource',
|
||||
'SAXException',
|
||||
'SAXNotRecognizedException',
|
||||
'SAXNotSupportedException',
|
||||
'SAXParseException',
|
||||
'SAXReaderNotAvailable',
|
||||
)
|
||||
check__all__(self, sax, extra=extra)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue