aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_importlib/test_metadata_api.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-04-17 11:10:26 -0400
committerGitHub <noreply@github.com>2022-04-17 11:10:26 -0400
commit67712e71b3f20541326d57a475f4bd369a98d918 (patch)
tree053c49f69ba1d1a31dbdba59862018e50224d61b /Lib/test/test_importlib/test_metadata_api.py
parent3289209716011b21128f45de69f4a8e9d376c78e (diff)
downloadcpython-67712e71b3f20541326d57a475f4bd369a98d918.tar.gz
cpython-67712e71b3f20541326d57a475f4bd369a98d918.zip
bpo-46126: Restore docstrings in importlib.metadata tests. (#32288)
Diffstat (limited to 'Lib/test/test_importlib/test_metadata_api.py')
-rw-r--r--Lib/test/test_importlib/test_metadata_api.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/Lib/test/test_importlib/test_metadata_api.py b/Lib/test/test_importlib/test_metadata_api.py
index b3627cbb75b..c86bb4df19c 100644
--- a/Lib/test/test_importlib/test_metadata_api.py
+++ b/Lib/test/test_importlib/test_metadata_api.py
@@ -90,8 +90,10 @@ class APITests(
self.assertEqual(ep.dist.version, "1.0.0")
def test_entry_points_unique_packages(self):
- # Entry points should only be exposed for the first package
- # on sys.path with a given name.
+ """
+ Entry points should only be exposed for the first package
+ on sys.path with a given name.
+ """
alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
alt_pkg = {
@@ -123,9 +125,11 @@ class APITests(
assert entry_points(group='missing') == ()
def test_entry_points_dict_construction(self):
- # Prior versions of entry_points() returned simple lists and
- # allowed casting those lists into maps by name using ``dict()``.
- # Capture this now deprecated use-case.
+ """
+ Prior versions of entry_points() returned simple lists and
+ allowed casting those lists into maps by name using ``dict()``.
+ Capture this now deprecated use-case.
+ """
with suppress_known_deprecation() as caught:
eps = dict(entry_points(group='entries'))
@@ -154,9 +158,11 @@ class APITests(
assert "Accessing entry points by index is deprecated" in str(expected)
def test_entry_points_groups_getitem(self):
- # Prior versions of entry_points() returned a dict. Ensure
- # that callers using '.__getitem__()' are supported but warned to
- # migrate.
+ """
+ Prior versions of entry_points() returned a dict. Ensure
+ that callers using '.__getitem__()' are supported but warned to
+ migrate.
+ """
with suppress_known_deprecation():
entry_points()['entries'] == entry_points(group='entries')
@@ -164,9 +170,11 @@ class APITests(
entry_points()['missing']
def test_entry_points_groups_get(self):
- # Prior versions of entry_points() returned a dict. Ensure
- # that callers using '.get()' are supported but warned to
- # migrate.
+ """
+ Prior versions of entry_points() returned a dict. Ensure
+ that callers using '.get()' are supported but warned to
+ migrate.
+ """
with suppress_known_deprecation():
entry_points().get('missing', 'default') == 'default'
entry_points().get('entries', 'default') == entry_points()['entries']
@@ -313,7 +321,7 @@ class OffSysPathTests(fixtures.DistInfoPkgOffPath, unittest.TestCase):
assert any(dist.metadata['Name'] == 'distinfo-pkg' for dist in dists)
def test_distribution_at_pathlib(self):
- # Demonstrate how to load metadata direct from a directory.
+ """Demonstrate how to load metadata direct from a directory."""
dist_info_path = self.site_dir / 'distinfo_pkg-1.0.0.dist-info'
dist = Distribution.at(dist_info_path)
assert dist.version == '1.0.0'