summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-03-29 22:07:15 (GMT)
committerGitHub <noreply@github.com>2022-03-29 22:07:15 (GMT)
commit63f32fae79e16e6dc71777bd3fcb623b2c3ff742 (patch)
treea3f3dc751d2b8b4baae90919a31dc25be2855474 /Lib/test/test_pydoc.py
parenta5ba445322f723e04a3e901365512360a99c54d4 (diff)
downloadcpython-63f32fae79e16e6dc71777bd3fcb623b2c3ff742.zip
cpython-63f32fae79e16e6dc71777bd3fcb623b2c3ff742.tar.gz
cpython-63f32fae79e16e6dc71777bd3fcb623b2c3ff742.tar.bz2
bpo-26120: do not exclude __future__ import in pydoc of the __future__ module itself (GH-32180)
Diffstat (limited to 'Lib/test/test_pydoc.py')
-rw-r--r--Lib/test/test_pydoc.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index e2dab12..9c900c3 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -850,6 +850,23 @@ class B(A)
for expected_line in expected_lines:
self.assertIn(expected_line, as_text)
+ def test__future__imports(self):
+ # __future__ features are excluded from module help,
+ # except when it's the __future__ module itself
+ import __future__
+ future_text, _ = get_pydoc_text(__future__)
+ future_html, _ = get_pydoc_html(__future__)
+ pydoc_mod_text, _ = get_pydoc_text(pydoc_mod)
+ pydoc_mod_html, _ = get_pydoc_html(pydoc_mod)
+
+ for feature in __future__.all_feature_names:
+ txt = f"{feature} = _Feature"
+ html = f"<strong>{feature}</strong> = _Feature"
+ self.assertIn(txt, future_text)
+ self.assertIn(html, future_html)
+ self.assertNotIn(txt, pydoc_mod_text)
+ self.assertNotIn(html, pydoc_mod_html)
+
class PydocImportTest(PydocBaseTest):