2023-08-11 12:08:38 -03:00
|
|
|
import datetime
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
import os
|
2010-12-03 05:29:11 -04:00
|
|
|
import sys
|
2013-05-19 10:44:54 -03:00
|
|
|
import contextlib
|
2015-02-16 20:45:01 -04:00
|
|
|
import importlib.util
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
import inspect
|
2010-12-03 05:29:11 -04:00
|
|
|
import pydoc
|
2015-02-16 20:45:01 -04:00
|
|
|
import py_compile
|
2011-04-28 01:42:55 -03:00
|
|
|
import keyword
|
2014-02-21 03:34:46 -04:00
|
|
|
import _pickle
|
2013-05-19 10:44:54 -03:00
|
|
|
import pkgutil
|
2010-12-03 05:29:11 -04:00
|
|
|
import re
|
2015-02-16 20:45:01 -04:00
|
|
|
import stat
|
2018-04-15 08:52:57 -03:00
|
|
|
import tempfile
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
import test.support
|
2023-08-11 12:08:38 -03:00
|
|
|
import time
|
2013-10-21 02:37:39 -03:00
|
|
|
import types
|
2016-10-22 11:55:18 -03:00
|
|
|
import typing
|
2010-12-03 05:29:11 -04:00
|
|
|
import unittest
|
2024-06-08 06:19:13 -03:00
|
|
|
import unittest.mock
|
2014-07-10 13:18:00 -03:00
|
|
|
import urllib.parse
|
2010-03-31 00:19:28 -03:00
|
|
|
import xml.etree
|
2016-06-03 20:28:35 -03:00
|
|
|
import xml.etree.ElementTree
|
2010-12-03 03:47:22 -04:00
|
|
|
import textwrap
|
|
|
|
from io import StringIO
|
2011-03-25 18:15:24 -03:00
|
|
|
from collections import namedtuple
|
2021-11-07 19:44:11 -04:00
|
|
|
from urllib.request import urlopen, urlcleanup
|
2023-09-14 03:12:17 -03:00
|
|
|
from test import support
|
2021-09-15 13:19:30 -03:00
|
|
|
from test.support import import_helper
|
2020-08-03 13:47:42 -03:00
|
|
|
from test.support import os_helper
|
2023-07-11 15:04:09 -03:00
|
|
|
from test.support.script_helper import (assert_python_ok,
|
|
|
|
assert_python_failure, spawn_python)
|
2020-05-27 19:10:27 -03:00
|
|
|
from test.support import threading_helper
|
2024-06-15 14:56:40 -03:00
|
|
|
from test.support import (reap_children, captured_stdout,
|
2022-05-16 11:02:37 -03:00
|
|
|
captured_stderr, is_emscripten, is_wasi,
|
2023-12-23 05:56:30 -04:00
|
|
|
requires_docstrings, MISSING_C_DOCSTRINGS)
|
2020-08-03 13:47:42 -03:00
|
|
|
from test.support.os_helper import (TESTFN, rmtree, unlink)
|
2024-02-13 06:40:40 -04:00
|
|
|
from test.test_pydoc import pydoc_mod
|
|
|
|
from test.test_pydoc import pydocfodder
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2011-05-19 21:29:13 -03:00
|
|
|
|
2015-02-20 17:46:06 -04:00
|
|
|
class nonascii:
|
|
|
|
'Це не латиниця'
|
|
|
|
pass
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
if test.support.HAVE_DOCSTRINGS:
|
|
|
|
expected_data_docstrings = (
|
2023-11-19 14:30:07 -04:00
|
|
|
'dictionary for instance variables',
|
|
|
|
'list of weak references to the object',
|
2013-01-27 13:47:45 -04:00
|
|
|
) * 2
|
|
|
|
else:
|
|
|
|
expected_data_docstrings = ('', '', '', '')
|
|
|
|
|
2010-04-16 21:19:56 -03:00
|
|
|
expected_text_pattern = """
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
NAME
|
2024-02-13 06:40:40 -04:00
|
|
|
test.test_pydoc.pydoc_mod - This is a test module for test_pydoc
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
%s
|
|
|
|
CLASSES
|
|
|
|
builtins.object
|
|
|
|
A
|
|
|
|
B
|
2014-06-07 20:44:00 -03:00
|
|
|
C
|
2022-06-27 07:33:34 -03:00
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
class A(builtins.object)
|
|
|
|
| Hello and goodbye
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| Methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| __init__()
|
|
|
|
| Wow, I have no function!
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data descriptors defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
| __dict__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
| __weakref__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
class B(builtins.object)
|
2024-06-11 10:06:49 -03:00
|
|
|
| Methods defined here:
|
|
|
|
|
|
|
|
|
| __annotate__(...)
|
|
|
|
|
|
|
|
|
| ----------------------------------------------------------------------
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| Data descriptors defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
| __dict__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
| __weakref__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data and other attributes defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
| NO_MEANING = 'eggs'
|
2022-06-27 07:33:34 -03:00
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
class C(builtins.object)
|
|
|
|
| Methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| get_answer(self)
|
|
|
|
| Return say_no()
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| is_it_true(self)
|
|
|
|
| Return self.get_answer()
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| say_no(self)
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| ----------------------------------------------------------------------
|
2022-03-18 06:05:18 -03:00
|
|
|
| Class methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2024-02-11 09:19:44 -04:00
|
|
|
| __class_getitem__(item)
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2022-03-18 06:05:18 -03:00
|
|
|
| ----------------------------------------------------------------------
|
2014-06-07 20:44:00 -03:00
|
|
|
| Data descriptors defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| __dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
| dictionary for instance variables
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2014-06-07 20:44:00 -03:00
|
|
|
| __weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
| list of weak references to the object
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
FUNCTIONS
|
|
|
|
doc_func()
|
|
|
|
This function solves all of the world's problems:
|
|
|
|
hunger
|
|
|
|
lack of Python
|
|
|
|
war
|
2022-06-27 07:33:34 -03:00
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
nodoc_func()
|
|
|
|
|
|
|
|
DATA
|
2010-11-17 21:52:54 -04:00
|
|
|
__xyz__ = 'X, Y and Z'
|
2024-02-13 06:40:40 -04:00
|
|
|
c_alias = test.test_pydoc.pydoc_mod.C[int]
|
2022-03-18 06:05:18 -03:00
|
|
|
list_alias1 = typing.List[int]
|
|
|
|
list_alias2 = list[int]
|
|
|
|
type_union1 = typing.Union[int, str]
|
|
|
|
type_union2 = int | str
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
VERSION
|
|
|
|
1.2.3.4
|
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
Benjamin Peterson
|
|
|
|
|
|
|
|
CREDITS
|
|
|
|
Nobody
|
2010-11-17 21:52:54 -04:00
|
|
|
|
|
|
|
FILE
|
|
|
|
%s
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
""".strip()
|
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
expected_text_data_docstrings = tuple('\n | ' + s if s else ''
|
|
|
|
for s in expected_data_docstrings)
|
|
|
|
|
2021-10-09 04:36:50 -03:00
|
|
|
html2text_of_expected = """
|
2024-02-13 06:40:40 -04:00
|
|
|
test.test_pydoc.pydoc_mod (version 1.2.3.4)
|
2021-10-09 04:36:50 -03:00
|
|
|
This is a test module for test_pydoc
|
|
|
|
|
2022-03-18 06:05:18 -03:00
|
|
|
Modules
|
|
|
|
types
|
|
|
|
typing
|
|
|
|
|
2021-10-09 04:36:50 -03:00
|
|
|
Classes
|
|
|
|
builtins.object
|
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
|
|
|
|
|
|
|
class A(builtins.object)
|
|
|
|
Hello and goodbye
|
|
|
|
|
|
|
|
Methods defined here:
|
|
|
|
__init__()
|
|
|
|
Wow, I have no function!
|
2024-02-11 09:19:44 -04:00
|
|
|
----------------------------------------------------------------------
|
2021-10-09 04:36:50 -03:00
|
|
|
Data descriptors defined here:
|
|
|
|
__dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
dictionary for instance variables
|
2021-10-09 04:36:50 -03:00
|
|
|
__weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
list of weak references to the object
|
2021-10-09 04:36:50 -03:00
|
|
|
|
|
|
|
class B(builtins.object)
|
2024-06-11 10:06:49 -03:00
|
|
|
Methods defined here:
|
|
|
|
__annotate__(...)
|
|
|
|
----------------------------------------------------------------------
|
2021-10-09 04:36:50 -03:00
|
|
|
Data descriptors defined here:
|
|
|
|
__dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
dictionary for instance variables
|
2021-10-09 04:36:50 -03:00
|
|
|
__weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
list of weak references to the object
|
2024-02-11 09:19:44 -04:00
|
|
|
----------------------------------------------------------------------
|
2021-10-09 04:36:50 -03:00
|
|
|
Data and other attributes defined here:
|
|
|
|
NO_MEANING = 'eggs'
|
|
|
|
|
|
|
|
|
|
|
|
class C(builtins.object)
|
|
|
|
Methods defined here:
|
|
|
|
get_answer(self)
|
|
|
|
Return say_no()
|
|
|
|
is_it_true(self)
|
|
|
|
Return self.get_answer()
|
|
|
|
say_no(self)
|
2024-02-11 09:19:44 -04:00
|
|
|
----------------------------------------------------------------------
|
2022-03-18 06:05:18 -03:00
|
|
|
Class methods defined here:
|
2024-02-11 09:19:44 -04:00
|
|
|
__class_getitem__(item)
|
|
|
|
----------------------------------------------------------------------
|
2021-10-09 04:36:50 -03:00
|
|
|
Data descriptors defined here:
|
|
|
|
__dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
dictionary for instance variables
|
2021-10-09 04:36:50 -03:00
|
|
|
__weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
list of weak references to the object
|
2021-10-09 04:36:50 -03:00
|
|
|
|
|
|
|
Functions
|
|
|
|
doc_func()
|
|
|
|
This function solves all of the world's problems:
|
|
|
|
hunger
|
|
|
|
lack of Python
|
|
|
|
war
|
|
|
|
nodoc_func()
|
|
|
|
|
|
|
|
Data
|
|
|
|
__xyz__ = 'X, Y and Z'
|
2024-02-13 06:40:40 -04:00
|
|
|
c_alias = test.test_pydoc.pydoc_mod.C[int]
|
2022-03-18 06:05:18 -03:00
|
|
|
list_alias1 = typing.List[int]
|
|
|
|
list_alias2 = list[int]
|
|
|
|
type_union1 = typing.Union[int, str]
|
|
|
|
type_union2 = int | str
|
2021-10-09 04:36:50 -03:00
|
|
|
|
|
|
|
Author
|
|
|
|
Benjamin Peterson
|
|
|
|
|
|
|
|
Credits
|
|
|
|
Nobody
|
|
|
|
"""
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2013-01-27 13:47:45 -04:00
|
|
|
expected_html_data_docstrings = tuple(s.replace(' ', ' ')
|
|
|
|
for s in expected_data_docstrings)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
# output pattern for missing module
|
2015-02-28 18:42:54 -04:00
|
|
|
missing_pattern = '''\
|
|
|
|
No Python documentation found for %r.
|
|
|
|
Use help() to get the interactive help utility.
|
|
|
|
Use help(str) for help on the str class.'''.replace('\n', os.linesep)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
Merged revisions 73004,73439,73496,73509,73529,73564,73576-73577,73595-73596,73605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73004 | jeffrey.yasskin | 2009-05-28 22:44:31 -0500 (Thu, 28 May 2009) | 5 lines
Fix nearly all compilation warnings under Apple gcc-4.0. Tested with OPT="-g
-Wall -Wstrict-prototypes -Werror" in both --with-pydebug mode and --without.
There's still a batch of non-prototype warnings in Xlib.h that I don't know how
to fix.
........
r73439 | benjamin.peterson | 2009-06-15 19:29:31 -0500 (Mon, 15 Jun 2009) | 1 line
don't mask encoding errors when decoding a string #6289
........
r73496 | vinay.sajip | 2009-06-21 12:37:27 -0500 (Sun, 21 Jun 2009) | 1 line
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
........
r73509 | amaury.forgeotdarc | 2009-06-22 14:33:48 -0500 (Mon, 22 Jun 2009) | 2 lines
#4490 Fix sample code run by "python -m xml.sax.xmlreader"
........
r73529 | r.david.murray | 2009-06-23 13:02:46 -0500 (Tue, 23 Jun 2009) | 4 lines
Fix issue 5230 by having pydoc's safeimport check to see if the import
error was thrown from itself in order to decide if the module can't be
found. Thanks to Lucas Prado Melo for collaborating on the fix and tests.
........
r73564 | amaury.forgeotdarc | 2009-06-25 17:29:29 -0500 (Thu, 25 Jun 2009) | 6 lines
#2016 Fix a crash in function call when the **kwargs dictionary is mutated
during the function call setup.
This even gives a slight speedup, probably because tuple allocation
is faster than PyMem_NEW.
........
r73576 | benjamin.peterson | 2009-06-26 18:37:06 -0500 (Fri, 26 Jun 2009) | 1 line
document is_declared_global()
........
r73577 | benjamin.peterson | 2009-06-27 09:16:23 -0500 (Sat, 27 Jun 2009) | 1 line
link to extensive generator docs in the reference manual
........
r73595 | ezio.melotti | 2009-06-27 18:45:39 -0500 (Sat, 27 Jun 2009) | 1 line
stmt and setup can contain multiple statements, see #5896
........
r73596 | ezio.melotti | 2009-06-27 19:07:45 -0500 (Sat, 27 Jun 2009) | 1 line
Fixed a wrong apostrophe
........
r73605 | georg.brandl | 2009-06-28 07:10:18 -0500 (Sun, 28 Jun 2009) | 1 line
Remove stray pychecker directive.
........
2009-06-28 14:22:03 -03:00
|
|
|
# output pattern for module with bad imports
|
2016-09-07 20:56:15 -03:00
|
|
|
badimport_pattern = "problem in %s - ModuleNotFoundError: No module named %r"
|
Merged revisions 73004,73439,73496,73509,73529,73564,73576-73577,73595-73596,73605 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73004 | jeffrey.yasskin | 2009-05-28 22:44:31 -0500 (Thu, 28 May 2009) | 5 lines
Fix nearly all compilation warnings under Apple gcc-4.0. Tested with OPT="-g
-Wall -Wstrict-prototypes -Werror" in both --with-pydebug mode and --without.
There's still a batch of non-prototype warnings in Xlib.h that I don't know how
to fix.
........
r73439 | benjamin.peterson | 2009-06-15 19:29:31 -0500 (Mon, 15 Jun 2009) | 1 line
don't mask encoding errors when decoding a string #6289
........
r73496 | vinay.sajip | 2009-06-21 12:37:27 -0500 (Sun, 21 Jun 2009) | 1 line
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
........
r73509 | amaury.forgeotdarc | 2009-06-22 14:33:48 -0500 (Mon, 22 Jun 2009) | 2 lines
#4490 Fix sample code run by "python -m xml.sax.xmlreader"
........
r73529 | r.david.murray | 2009-06-23 13:02:46 -0500 (Tue, 23 Jun 2009) | 4 lines
Fix issue 5230 by having pydoc's safeimport check to see if the import
error was thrown from itself in order to decide if the module can't be
found. Thanks to Lucas Prado Melo for collaborating on the fix and tests.
........
r73564 | amaury.forgeotdarc | 2009-06-25 17:29:29 -0500 (Thu, 25 Jun 2009) | 6 lines
#2016 Fix a crash in function call when the **kwargs dictionary is mutated
during the function call setup.
This even gives a slight speedup, probably because tuple allocation
is faster than PyMem_NEW.
........
r73576 | benjamin.peterson | 2009-06-26 18:37:06 -0500 (Fri, 26 Jun 2009) | 1 line
document is_declared_global()
........
r73577 | benjamin.peterson | 2009-06-27 09:16:23 -0500 (Sat, 27 Jun 2009) | 1 line
link to extensive generator docs in the reference manual
........
r73595 | ezio.melotti | 2009-06-27 18:45:39 -0500 (Sat, 27 Jun 2009) | 1 line
stmt and setup can contain multiple statements, see #5896
........
r73596 | ezio.melotti | 2009-06-27 19:07:45 -0500 (Sat, 27 Jun 2009) | 1 line
Fixed a wrong apostrophe
........
r73605 | georg.brandl | 2009-06-28 07:10:18 -0500 (Sun, 28 Jun 2009) | 1 line
Remove stray pychecker directive.
........
2009-06-28 14:22:03 -03:00
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
expected_dynamicattribute_pattern = """
|
|
|
|
Help on class DA in module %s:
|
|
|
|
|
|
|
|
class DA(builtins.object)
|
|
|
|
| Data descriptors defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
| __dict__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
| __weakref__%s
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| ham
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data and other attributes inherited from Meta:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| ham = 'spam'
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
expected_virtualattribute_pattern1 = """
|
|
|
|
Help on class Class in module %s:
|
|
|
|
|
|
|
|
class Class(builtins.object)
|
|
|
|
| Data and other attributes inherited from Meta:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| LIFE = 42
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
expected_virtualattribute_pattern2 = """
|
|
|
|
Help on class Class1 in module %s:
|
|
|
|
|
|
|
|
class Class1(builtins.object)
|
|
|
|
| Data and other attributes inherited from Meta1:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| one = 1
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
expected_virtualattribute_pattern3 = """
|
|
|
|
Help on class Class2 in module %s:
|
|
|
|
|
|
|
|
class Class2(Class1)
|
|
|
|
| Method resolution order:
|
|
|
|
| Class2
|
|
|
|
| Class1
|
|
|
|
| builtins.object
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| Data and other attributes inherited from Meta1:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| one = 1
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data and other attributes inherited from Meta3:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| three = 3
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data and other attributes inherited from Meta2:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| two = 2
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
expected_missingattribute_pattern = """
|
|
|
|
Help on class C in module %s:
|
|
|
|
|
|
|
|
class C(builtins.object)
|
|
|
|
| Data and other attributes defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
| here = 'present!'
|
|
|
|
""".strip()
|
|
|
|
|
2011-07-15 17:42:12 -03:00
|
|
|
def run_pydoc(module_name, *args, **env):
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
"""
|
|
|
|
Runs pydoc on the specified module. Returns the stripped
|
|
|
|
output of pydoc.
|
|
|
|
"""
|
2011-07-15 17:42:12 -03:00
|
|
|
args = args + (module_name,)
|
2011-10-06 18:19:03 -03:00
|
|
|
# do not write bytecode files to avoid caching errors
|
|
|
|
rc, out, err = assert_python_ok('-B', pydoc.__file__, *args, **env)
|
2011-07-15 17:42:12 -03:00
|
|
|
return out.strip()
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2021-08-26 09:22:02 -03:00
|
|
|
def run_pydoc_fail(module_name, *args, **env):
|
|
|
|
"""
|
|
|
|
Runs pydoc on the specified module expecting a failure.
|
|
|
|
"""
|
|
|
|
args = args + (module_name,)
|
|
|
|
rc, out, err = assert_python_failure('-B', pydoc.__file__, *args, **env)
|
|
|
|
return out.strip()
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
def get_pydoc_html(module):
|
|
|
|
"Returns pydoc generated output as html"
|
|
|
|
doc = pydoc.HTMLDoc()
|
|
|
|
output = doc.docmodule(module)
|
|
|
|
loc = doc.getdocloc(pydoc_mod) or ""
|
|
|
|
if loc:
|
|
|
|
loc = "<br><a href=\"" + loc + "\">Module Docs</a>"
|
|
|
|
return output.strip(), loc
|
|
|
|
|
2024-02-11 09:19:44 -04:00
|
|
|
def clean_text(doc):
|
|
|
|
# clean up the extra text formatting that pydoc performs
|
|
|
|
return re.sub('\b.', '', doc)
|
|
|
|
|
2016-06-03 20:28:35 -03:00
|
|
|
def get_pydoc_link(module):
|
|
|
|
"Returns a documentation web link of a module"
|
2018-07-29 16:15:14 -03:00
|
|
|
abspath = os.path.abspath
|
2016-06-03 20:28:35 -03:00
|
|
|
dirname = os.path.dirname
|
2024-02-13 06:40:40 -04:00
|
|
|
basedir = dirname(dirname(dirname(abspath(__file__))))
|
2016-06-03 20:28:35 -03:00
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
loc = doc.getdocloc(module, basedir=basedir)
|
|
|
|
return loc
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
def get_pydoc_text(module):
|
|
|
|
"Returns pydoc generated output as text"
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
loc = doc.getdocloc(pydoc_mod) or ""
|
|
|
|
if loc:
|
|
|
|
loc = "\nMODULE DOCS\n " + loc + "\n"
|
|
|
|
|
|
|
|
output = doc.docmodule(module)
|
2024-02-11 09:19:44 -04:00
|
|
|
output = clean_text(output)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
return output.strip(), loc
|
|
|
|
|
2010-12-03 05:29:11 -04:00
|
|
|
def get_html_title(text):
|
2010-12-03 12:08:46 -04:00
|
|
|
# Bit of hack, but good enough for test purposes
|
|
|
|
header, _, _ = text.partition("</head>")
|
|
|
|
_, _, title = header.partition("<title>")
|
|
|
|
title, _, _ = title.partition("</title>")
|
2010-12-03 05:29:11 -04:00
|
|
|
return title
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2021-10-09 04:36:50 -03:00
|
|
|
def html2text(html):
|
|
|
|
"""A quick and dirty implementation of html2text.
|
|
|
|
|
|
|
|
Tailored for pydoc tests only.
|
|
|
|
"""
|
2022-03-17 13:32:53 -03:00
|
|
|
html = html.replace("<dd>", "\n")
|
2024-02-11 09:19:44 -04:00
|
|
|
html = html.replace("<hr>", "-"*70)
|
2022-03-17 13:32:53 -03:00
|
|
|
html = re.sub("<.*?>", "", html)
|
|
|
|
html = pydoc.replace(html, " ", " ", ">", ">", "<", "<")
|
|
|
|
return html
|
2021-10-09 04:36:50 -03:00
|
|
|
|
|
|
|
|
2013-05-19 10:44:54 -03:00
|
|
|
class PydocBaseTest(unittest.TestCase):
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
# Self-testing. Mocking only works if sys.modules['pydoc'] and pydoc
|
|
|
|
# are the same. But some pydoc functions reload the module and change
|
|
|
|
# sys.modules, so check that it was restored.
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
2013-05-19 10:44:54 -03:00
|
|
|
|
|
|
|
def _restricted_walk_packages(self, walk_packages, path=None):
|
|
|
|
"""
|
|
|
|
A version of pkgutil.walk_packages() that will restrict itself to
|
|
|
|
a given path.
|
|
|
|
"""
|
|
|
|
default_path = path or [os.path.dirname(__file__)]
|
|
|
|
def wrapper(path=None, prefix='', onerror=None):
|
|
|
|
return walk_packages(path or default_path, prefix, onerror)
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
@contextlib.contextmanager
|
|
|
|
def restrict_walk_packages(self, path=None):
|
|
|
|
walk_packages = pkgutil.walk_packages
|
|
|
|
pkgutil.walk_packages = self._restricted_walk_packages(walk_packages,
|
|
|
|
path)
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
|
|
|
pkgutil.walk_packages = walk_packages
|
|
|
|
|
2015-11-05 20:27:14 -04:00
|
|
|
def call_url_handler(self, url, expected_title):
|
|
|
|
text = pydoc._url_handler(url, "text/html")
|
|
|
|
result = get_html_title(text)
|
|
|
|
# Check the title to ensure an unexpected error page was not returned
|
|
|
|
self.assertEqual(result, expected_title, text)
|
|
|
|
return text
|
|
|
|
|
2013-05-19 10:44:54 -03:00
|
|
|
|
2011-01-30 04:37:19 -04:00
|
|
|
class PydocDocTest(unittest.TestCase):
|
2018-11-08 02:48:11 -04:00
|
|
|
maxDiff = None
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2011-02-21 23:04:06 -04:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2014-06-20 18:59:12 -03:00
|
|
|
@requires_docstrings
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
def test_html_doc(self):
|
|
|
|
result, doc_loc = get_pydoc_html(pydoc_mod)
|
2021-10-09 04:36:50 -03:00
|
|
|
text_result = html2text(result)
|
2022-03-17 13:32:53 -03:00
|
|
|
text_lines = [line.strip() for line in text_result.splitlines()]
|
|
|
|
text_lines = [line for line in text_lines if line]
|
|
|
|
del text_lines[1]
|
|
|
|
expected_lines = html2text_of_expected.splitlines()
|
|
|
|
expected_lines = [line.strip() for line in expected_lines if line]
|
|
|
|
self.assertEqual(text_lines, expected_lines)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
mod_file = inspect.getabsfile(pydoc_mod)
|
2014-07-10 13:18:00 -03:00
|
|
|
mod_url = urllib.parse.quote(mod_file)
|
2021-10-09 04:36:50 -03:00
|
|
|
self.assertIn(mod_url, result)
|
|
|
|
self.assertIn(mod_file, result)
|
|
|
|
self.assertIn(doc_loc, result)
|
|
|
|
|
2011-02-21 23:04:06 -04:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2014-06-20 18:59:12 -03:00
|
|
|
@requires_docstrings
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
def test_text_doc(self):
|
|
|
|
result, doc_loc = get_pydoc_text(pydoc_mod)
|
2013-01-27 13:47:45 -04:00
|
|
|
expected_text = expected_text_pattern % (
|
|
|
|
(doc_loc,) +
|
|
|
|
expected_text_data_docstrings +
|
|
|
|
(inspect.getabsfile(pydoc_mod),))
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text, result)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2014-02-19 17:05:12 -04:00
|
|
|
def test_text_enum_member_with_value_zero(self):
|
|
|
|
# Test issue #20654 to ensure enum member with value 0 can be
|
|
|
|
# displayed. It used to throw KeyError: 'zero'.
|
|
|
|
import enum
|
|
|
|
class BinaryInteger(enum.IntEnum):
|
|
|
|
zero = 0
|
|
|
|
one = 1
|
|
|
|
doc = pydoc.render_doc(BinaryInteger)
|
2021-03-31 01:17:26 -03:00
|
|
|
self.assertIn('BinaryInteger.zero', doc)
|
2014-02-19 17:05:12 -04:00
|
|
|
|
2016-06-03 20:28:35 -03:00
|
|
|
def test_mixed_case_module_names_are_lower_cased(self):
|
|
|
|
# issue16484
|
|
|
|
doc_link = get_pydoc_link(xml.etree.ElementTree)
|
|
|
|
self.assertIn('xml.etree.elementtree', doc_link)
|
|
|
|
|
2010-03-31 00:19:28 -03:00
|
|
|
def test_issue8225(self):
|
|
|
|
# Test issue8225 to ensure no doc link appears for xml.etree
|
|
|
|
result, doc_loc = get_pydoc_text(xml.etree)
|
|
|
|
self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
|
|
|
|
|
2014-06-08 00:14:26 -03:00
|
|
|
def test_getpager_with_stdin_none(self):
|
|
|
|
previous_stdin = sys.stdin
|
|
|
|
try:
|
|
|
|
sys.stdin = None
|
|
|
|
pydoc.getpager() # Shouldn't fail.
|
|
|
|
finally:
|
|
|
|
sys.stdin = previous_stdin
|
|
|
|
|
2012-04-23 14:23:57 -03:00
|
|
|
def test_non_str_name(self):
|
|
|
|
# issue14638
|
|
|
|
# Treat illegal (non-str) name like no name
|
2020-04-18 13:19:32 -03:00
|
|
|
|
2012-04-23 14:23:57 -03:00
|
|
|
class A:
|
|
|
|
__name__ = 42
|
|
|
|
class B:
|
|
|
|
pass
|
|
|
|
adoc = pydoc.render_doc(A())
|
|
|
|
bdoc = pydoc.render_doc(B())
|
2016-09-08 19:11:11 -03:00
|
|
|
self.assertEqual(adoc.replace("A", "B"), bdoc)
|
2012-04-23 14:23:57 -03:00
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
def test_not_here(self):
|
|
|
|
missing_module = "test.i_am_not_here"
|
2021-08-26 09:22:02 -03:00
|
|
|
result = str(run_pydoc_fail(missing_module), 'ascii')
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
expected = missing_pattern % missing_module
|
|
|
|
self.assertEqual(expected, result,
|
|
|
|
"documentation for missing module found")
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2015-02-20 17:46:06 -04:00
|
|
|
def test_not_ascii(self):
|
2024-02-13 06:40:40 -04:00
|
|
|
result = run_pydoc('test.test_pydoc.test_pydoc.nonascii', PYTHONIOENCODING='ascii')
|
2015-02-20 17:46:06 -04:00
|
|
|
encoded = nonascii.__doc__.encode('ascii', 'backslashreplace')
|
|
|
|
self.assertIn(encoded, result)
|
|
|
|
|
2009-05-27 17:56:59 -03:00
|
|
|
def test_input_strip(self):
|
|
|
|
missing_module = " test.i_am_not_here "
|
2021-08-26 09:22:02 -03:00
|
|
|
result = str(run_pydoc_fail(missing_module), 'ascii')
|
2009-05-27 17:56:59 -03:00
|
|
|
expected = missing_pattern % missing_module.strip()
|
|
|
|
self.assertEqual(expected, result)
|
|
|
|
|
2010-02-16 19:31:04 -04:00
|
|
|
def test_stripid(self):
|
|
|
|
# test with strings, other implementations might have different repr()
|
|
|
|
stripid = pydoc.stripid
|
|
|
|
# strip the id
|
|
|
|
self.assertEqual(stripid('<function stripid at 0x88dcee4>'),
|
|
|
|
'<function stripid>')
|
|
|
|
self.assertEqual(stripid('<function stripid at 0x01F65390>'),
|
|
|
|
'<function stripid>')
|
|
|
|
# nothing to strip, return the same text
|
|
|
|
self.assertEqual(stripid('42'), '42')
|
|
|
|
self.assertEqual(stripid("<type 'exceptions.Exception'>"),
|
|
|
|
"<type 'exceptions.Exception'>")
|
|
|
|
|
2018-10-21 04:22:02 -03:00
|
|
|
def test_builtin_with_more_than_four_children(self):
|
|
|
|
"""Tests help on builtin object which have more than four child classes.
|
|
|
|
|
|
|
|
When running help() on a builtin class which has child classes, it
|
|
|
|
should contain a "Built-in subclasses" section and only 4 classes
|
|
|
|
should be displayed with a hint on how many more subclasses are present.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
>>> help(object)
|
|
|
|
Help on class object in module builtins:
|
|
|
|
|
|
|
|
class object
|
|
|
|
| The most base type
|
|
|
|
|
|
|
|
|
| Built-in subclasses:
|
|
|
|
| async_generator
|
|
|
|
| BaseException
|
|
|
|
| builtin_function_or_method
|
|
|
|
| bytearray
|
|
|
|
| ... and 82 other subclasses
|
|
|
|
"""
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
text = doc.docclass(object)
|
|
|
|
snip = (" | Built-in subclasses:\n"
|
|
|
|
" | async_generator\n"
|
|
|
|
" | BaseException\n"
|
|
|
|
" | builtin_function_or_method\n"
|
|
|
|
" | bytearray\n"
|
|
|
|
" | ... and \\d+ other subclasses")
|
|
|
|
self.assertRegex(text, snip)
|
|
|
|
|
|
|
|
def test_builtin_with_child(self):
|
|
|
|
"""Tests help on builtin object which have only child classes.
|
|
|
|
|
|
|
|
When running help() on a builtin class which has child classes, it
|
|
|
|
should contain a "Built-in subclasses" section. For example:
|
|
|
|
|
|
|
|
>>> help(ArithmeticError)
|
|
|
|
Help on class ArithmeticError in module builtins:
|
|
|
|
|
|
|
|
class ArithmeticError(Exception)
|
|
|
|
| Base class for arithmetic errors.
|
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
| Built-in subclasses:
|
|
|
|
| FloatingPointError
|
|
|
|
| OverflowError
|
|
|
|
| ZeroDivisionError
|
|
|
|
"""
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
text = doc.docclass(ArithmeticError)
|
|
|
|
snip = (" | Built-in subclasses:\n"
|
|
|
|
" | FloatingPointError\n"
|
|
|
|
" | OverflowError\n"
|
|
|
|
" | ZeroDivisionError")
|
|
|
|
self.assertIn(snip, text)
|
|
|
|
|
|
|
|
def test_builtin_with_grandchild(self):
|
|
|
|
"""Tests help on builtin classes which have grandchild classes.
|
|
|
|
|
|
|
|
When running help() on a builtin class which has child classes, it
|
|
|
|
should contain a "Built-in subclasses" section. However, if it also has
|
|
|
|
grandchildren, these should not show up on the subclasses section.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
>>> help(Exception)
|
|
|
|
Help on class Exception in module builtins:
|
|
|
|
|
|
|
|
class Exception(BaseException)
|
|
|
|
| Common base class for all non-exit exceptions.
|
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
| Built-in subclasses:
|
|
|
|
| ArithmeticError
|
|
|
|
| AssertionError
|
|
|
|
| AttributeError
|
|
|
|
...
|
|
|
|
"""
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
text = doc.docclass(Exception)
|
|
|
|
snip = (" | Built-in subclasses:\n"
|
|
|
|
" | ArithmeticError\n"
|
|
|
|
" | AssertionError\n"
|
|
|
|
" | AttributeError")
|
|
|
|
self.assertIn(snip, text)
|
|
|
|
# Testing that the grandchild ZeroDivisionError does not show up
|
|
|
|
self.assertNotIn('ZeroDivisionError', text)
|
|
|
|
|
|
|
|
def test_builtin_no_child(self):
|
|
|
|
"""Tests help on builtin object which have no child classes.
|
|
|
|
|
|
|
|
When running help() on a builtin class which has no child classes, it
|
|
|
|
should not contain any "Built-in subclasses" section. For example:
|
|
|
|
|
|
|
|
>>> help(ZeroDivisionError)
|
|
|
|
|
|
|
|
Help on class ZeroDivisionError in module builtins:
|
|
|
|
|
|
|
|
class ZeroDivisionError(ArithmeticError)
|
|
|
|
| Second argument to a division or modulo operation was zero.
|
|
|
|
|
|
|
|
|
| Method resolution order:
|
|
|
|
| ZeroDivisionError
|
|
|
|
| ArithmeticError
|
|
|
|
| Exception
|
|
|
|
| BaseException
|
|
|
|
| object
|
|
|
|
|
|
|
|
|
| Methods defined here:
|
|
|
|
...
|
|
|
|
"""
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
text = doc.docclass(ZeroDivisionError)
|
|
|
|
# Testing that the subclasses section does not appear
|
|
|
|
self.assertNotIn('Built-in subclasses', text)
|
|
|
|
|
2018-12-31 01:14:47 -04:00
|
|
|
def test_builtin_on_metaclasses(self):
|
|
|
|
"""Tests help on metaclasses.
|
|
|
|
|
|
|
|
When running help() on a metaclasses such as type, it
|
|
|
|
should not contain any "Built-in subclasses" section.
|
|
|
|
"""
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
text = doc.docclass(type)
|
|
|
|
# Testing that the subclasses section does not appear
|
|
|
|
self.assertNotIn('Built-in subclasses', text)
|
|
|
|
|
2023-07-11 15:04:09 -03:00
|
|
|
def test_fail_help_cli(self):
|
|
|
|
elines = (missing_pattern % 'abd').splitlines()
|
|
|
|
with spawn_python("-c" "help()") as proc:
|
|
|
|
out, _ = proc.communicate(b"abd")
|
|
|
|
olines = out.decode().splitlines()[-9:-6]
|
|
|
|
olines[0] = olines[0].removeprefix('help> ')
|
|
|
|
self.assertEqual(elines, olines)
|
|
|
|
|
2023-07-01 19:46:06 -03:00
|
|
|
def test_fail_help_output_redirect(self):
|
|
|
|
with StringIO() as buf:
|
|
|
|
helper = pydoc.Helper(output=buf)
|
|
|
|
helper.help("abd")
|
|
|
|
expected = missing_pattern % "abd"
|
|
|
|
self.assertEqual(expected, buf.getvalue().strip().replace('\n', os.linesep))
|
|
|
|
|
2011-02-21 23:04:06 -04:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2024-06-08 06:19:13 -03:00
|
|
|
@unittest.mock.patch('pydoc.pager')
|
2014-06-20 18:59:12 -03:00
|
|
|
@requires_docstrings
|
2024-06-08 06:19:13 -03:00
|
|
|
def test_help_output_redirect(self, pager_mock):
|
2010-12-03 03:47:22 -04:00
|
|
|
# issue 940286, if output is set in Helper, then all output from
|
|
|
|
# Helper.help should be redirected
|
|
|
|
self.maxDiff = None
|
|
|
|
|
|
|
|
unused, doc_loc = get_pydoc_text(pydoc_mod)
|
2024-02-13 06:40:40 -04:00
|
|
|
module = "test.test_pydoc.pydoc_mod"
|
2010-12-03 03:47:22 -04:00
|
|
|
help_header = """
|
2024-02-13 06:40:40 -04:00
|
|
|
Help on module test.test_pydoc.pydoc_mod in test.test_pydoc:
|
2010-12-03 03:47:22 -04:00
|
|
|
|
|
|
|
""".lstrip()
|
|
|
|
help_header = textwrap.dedent(help_header)
|
|
|
|
expected_help_pattern = help_header + expected_text_pattern
|
|
|
|
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as output, captured_stderr() as err:
|
|
|
|
buf = StringIO()
|
2024-06-08 06:19:13 -03:00
|
|
|
helper = pydoc.Helper(output=buf)
|
|
|
|
helper.help(module)
|
|
|
|
result = buf.getvalue().strip()
|
|
|
|
expected_text = expected_help_pattern % (
|
|
|
|
(doc_loc,) +
|
|
|
|
expected_text_data_docstrings +
|
|
|
|
(inspect.getabsfile(pydoc_mod),))
|
|
|
|
self.assertEqual('', output.getvalue())
|
|
|
|
self.assertEqual('', err.getvalue())
|
|
|
|
self.assertEqual(expected_text, result)
|
|
|
|
|
|
|
|
pager_mock.assert_not_called()
|
|
|
|
|
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
|
|
|
@requires_docstrings
|
|
|
|
@unittest.mock.patch('pydoc.pager')
|
|
|
|
def test_help_output_redirect_various_requests(self, pager_mock):
|
|
|
|
# issue 940286, if output is set in Helper, then all output from
|
|
|
|
# Helper.help should be redirected
|
|
|
|
|
|
|
|
def run_pydoc_for_request(request, expected_text_part):
|
|
|
|
"""Helper function to run pydoc with its output redirected"""
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as output, captured_stderr() as err:
|
|
|
|
buf = StringIO()
|
2024-06-08 06:19:13 -03:00
|
|
|
helper = pydoc.Helper(output=buf)
|
|
|
|
helper.help(request)
|
2010-12-03 03:47:22 -04:00
|
|
|
result = buf.getvalue().strip()
|
2024-06-08 06:19:13 -03:00
|
|
|
self.assertEqual('', output.getvalue(), msg=f'failed on request "{request}"')
|
|
|
|
self.assertEqual('', err.getvalue(), msg=f'failed on request "{request}"')
|
|
|
|
self.assertIn(expected_text_part, result, msg=f'failed on request "{request}"')
|
|
|
|
pager_mock.assert_not_called()
|
|
|
|
|
|
|
|
self.maxDiff = None
|
|
|
|
|
|
|
|
# test for "keywords"
|
|
|
|
run_pydoc_for_request('keywords', 'Here is a list of the Python keywords.')
|
|
|
|
# test for "symbols"
|
|
|
|
run_pydoc_for_request('symbols', 'Here is a list of the punctuation symbols')
|
|
|
|
# test for "topics"
|
|
|
|
run_pydoc_for_request('topics', 'Here is a list of available topics.')
|
|
|
|
# test for "modules" skipped, see test_modules()
|
|
|
|
# test for symbol "%"
|
|
|
|
run_pydoc_for_request('%', 'The power operator')
|
|
|
|
# test for special True, False, None keywords
|
|
|
|
run_pydoc_for_request('True', 'class bool(int)')
|
|
|
|
run_pydoc_for_request('False', 'class bool(int)')
|
|
|
|
run_pydoc_for_request('None', 'class NoneType(object)')
|
|
|
|
# test for keyword "assert"
|
|
|
|
run_pydoc_for_request('assert', 'The "assert" statement')
|
|
|
|
# test for topic "TYPES"
|
|
|
|
run_pydoc_for_request('TYPES', 'The standard type hierarchy')
|
|
|
|
# test for "pydoc.Helper.help"
|
|
|
|
run_pydoc_for_request('pydoc.Helper.help', 'Help on function help in pydoc.Helper:')
|
|
|
|
# test for pydoc.Helper.help
|
|
|
|
run_pydoc_for_request(pydoc.Helper.help, 'Help on function help in module pydoc:')
|
|
|
|
# test for pydoc.Helper() instance skipped because it is always meant to be interactive
|
|
|
|
|
2024-06-15 14:56:40 -03:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
|
|
|
@requires_docstrings
|
|
|
|
def test_help_output_pager(self):
|
|
|
|
def run_pydoc_pager(request, what, expected_first_line):
|
|
|
|
with (captured_stdout() as output,
|
|
|
|
captured_stderr() as err,
|
|
|
|
unittest.mock.patch('pydoc.pager') as pager_mock,
|
|
|
|
self.subTest(repr(request))):
|
|
|
|
helper = pydoc.Helper()
|
|
|
|
helper.help(request)
|
|
|
|
self.assertEqual('', err.getvalue())
|
|
|
|
self.assertEqual('\n', output.getvalue())
|
|
|
|
pager_mock.assert_called_once()
|
|
|
|
result = clean_text(pager_mock.call_args.args[0])
|
|
|
|
self.assertEqual(result.splitlines()[0], expected_first_line)
|
|
|
|
self.assertEqual(pager_mock.call_args.args[1], f'Help on {what}')
|
|
|
|
|
|
|
|
run_pydoc_pager('%', 'EXPRESSIONS', 'Operator precedence')
|
|
|
|
run_pydoc_pager('True', 'bool object', 'Help on bool object:')
|
|
|
|
run_pydoc_pager(True, 'bool object', 'Help on bool object:')
|
|
|
|
run_pydoc_pager('assert', 'assert', 'The "assert" statement')
|
|
|
|
run_pydoc_pager('TYPES', 'TYPES', 'The standard type hierarchy')
|
|
|
|
run_pydoc_pager('pydoc.Helper.help', 'pydoc.Helper.help',
|
|
|
|
'Help on function help in pydoc.Helper:')
|
|
|
|
run_pydoc_pager(pydoc.Helper.help, 'Helper.help',
|
|
|
|
'Help on function help in module pydoc:')
|
|
|
|
run_pydoc_pager('str', 'str', 'Help on class str in module builtins:')
|
|
|
|
run_pydoc_pager(str, 'str', 'Help on class str in module builtins:')
|
|
|
|
run_pydoc_pager('str.upper', 'str.upper', 'Help on method_descriptor in str:')
|
|
|
|
run_pydoc_pager(str.upper, 'str.upper', 'Help on method_descriptor:')
|
|
|
|
run_pydoc_pager(str.__add__, 'str.__add__', 'Help on wrapper_descriptor:')
|
|
|
|
run_pydoc_pager(int.numerator, 'int.numerator',
|
|
|
|
'Help on getset descriptor builtins.int.numerator:')
|
|
|
|
run_pydoc_pager(list[int], 'list',
|
|
|
|
'Help on GenericAlias in module builtins:')
|
|
|
|
run_pydoc_pager('sys', 'sys', 'Help on built-in module sys:')
|
|
|
|
run_pydoc_pager(sys, 'sys', 'Help on built-in module sys:')
|
|
|
|
|
2024-06-08 06:19:13 -03:00
|
|
|
def test_showtopic(self):
|
|
|
|
with captured_stdout() as showtopic_io:
|
|
|
|
helper = pydoc.Helper()
|
|
|
|
helper.showtopic('with')
|
|
|
|
helptext = showtopic_io.getvalue()
|
|
|
|
self.assertIn('The "with" statement', helptext)
|
|
|
|
|
|
|
|
def test_fail_showtopic(self):
|
|
|
|
with captured_stdout() as showtopic_io:
|
|
|
|
helper = pydoc.Helper()
|
|
|
|
helper.showtopic('abd')
|
|
|
|
expected = "no documentation found for 'abd'"
|
|
|
|
self.assertEqual(expected, showtopic_io.getvalue().strip())
|
|
|
|
|
|
|
|
@unittest.mock.patch('pydoc.pager')
|
|
|
|
def test_fail_showtopic_output_redirect(self, pager_mock):
|
|
|
|
with StringIO() as buf:
|
|
|
|
helper = pydoc.Helper(output=buf)
|
|
|
|
helper.showtopic("abd")
|
|
|
|
expected = "no documentation found for 'abd'"
|
|
|
|
self.assertEqual(expected, buf.getvalue().strip())
|
|
|
|
|
|
|
|
pager_mock.assert_not_called()
|
|
|
|
|
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
|
|
|
@requires_docstrings
|
|
|
|
@unittest.mock.patch('pydoc.pager')
|
|
|
|
def test_showtopic_output_redirect(self, pager_mock):
|
|
|
|
# issue 940286, if output is set in Helper, then all output from
|
|
|
|
# Helper.showtopic should be redirected
|
|
|
|
self.maxDiff = None
|
|
|
|
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as output, captured_stderr() as err:
|
|
|
|
buf = StringIO()
|
2024-06-08 06:19:13 -03:00
|
|
|
helper = pydoc.Helper(output=buf)
|
|
|
|
helper.showtopic('with')
|
|
|
|
result = buf.getvalue().strip()
|
|
|
|
self.assertEqual('', output.getvalue())
|
|
|
|
self.assertEqual('', err.getvalue())
|
|
|
|
self.assertIn('The "with" statement', result)
|
|
|
|
|
|
|
|
pager_mock.assert_not_called()
|
2010-12-03 03:47:22 -04:00
|
|
|
|
2024-02-17 08:47:51 -04:00
|
|
|
def test_lambda_with_return_annotation(self):
|
|
|
|
func = lambda a, b, c: 1
|
|
|
|
func.__annotations__ = {"return": int}
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as help_io:
|
2024-02-17 08:47:51 -04:00
|
|
|
pydoc.help(func)
|
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn("lambda (a, b, c) -> int", helptext)
|
|
|
|
|
|
|
|
def test_lambda_without_return_annotation(self):
|
|
|
|
func = lambda a, b, c: 1
|
|
|
|
func.__annotations__ = {"a": int, "b": int, "c": int}
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as help_io:
|
2024-02-17 08:47:51 -04:00
|
|
|
pydoc.help(func)
|
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn("lambda (a: int, b: int, c: int)", helptext)
|
|
|
|
|
|
|
|
def test_lambda_with_return_and_params_annotation(self):
|
|
|
|
func = lambda a, b, c: 1
|
|
|
|
func.__annotations__ = {"a": int, "b": int, "c": int, "return": int}
|
2024-06-15 14:56:40 -03:00
|
|
|
with captured_stdout() as help_io:
|
2024-02-17 08:47:51 -04:00
|
|
|
pydoc.help(func)
|
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn("lambda (a: int, b: int, c: int) -> int", helptext)
|
|
|
|
|
2018-12-31 08:15:16 -04:00
|
|
|
def test_namedtuple_fields(self):
|
|
|
|
Person = namedtuple('Person', ['nickname', 'firstname'])
|
|
|
|
with captured_stdout() as help_io:
|
|
|
|
pydoc.help(Person)
|
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn("nickname", helptext)
|
|
|
|
self.assertIn("firstname", helptext)
|
|
|
|
self.assertIn("Alias for field number 0", helptext)
|
|
|
|
self.assertIn("Alias for field number 1", helptext)
|
|
|
|
|
2011-03-25 18:15:24 -03:00
|
|
|
def test_namedtuple_public_underscore(self):
|
|
|
|
NT = namedtuple('NT', ['abc', 'def'], rename=True)
|
|
|
|
with captured_stdout() as help_io:
|
2013-11-04 22:43:26 -04:00
|
|
|
pydoc.help(NT)
|
2011-03-25 18:15:24 -03:00
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn('_1', helptext)
|
|
|
|
self.assertIn('_replace', helptext)
|
|
|
|
self.assertIn('_asdict', helptext)
|
|
|
|
|
2011-06-30 10:55:43 -03:00
|
|
|
def test_synopsis(self):
|
|
|
|
self.addCleanup(unlink, TESTFN)
|
|
|
|
for encoding in ('ISO-8859-1', 'UTF-8'):
|
|
|
|
with open(TESTFN, 'w', encoding=encoding) as script:
|
|
|
|
if encoding != 'UTF-8':
|
|
|
|
print('#coding: {}'.format(encoding), file=script)
|
|
|
|
print('"""line 1: h\xe9', file=script)
|
|
|
|
print('line 2: hi"""', file=script)
|
|
|
|
synopsis = pydoc.synopsis(TESTFN, {})
|
|
|
|
self.assertEqual(synopsis, 'line 1: h\xe9')
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2014-01-04 23:38:11 -04:00
|
|
|
def test_synopsis_sourceless(self):
|
2021-09-15 13:19:30 -03:00
|
|
|
os = import_helper.import_fresh_module('os')
|
2014-01-04 23:38:11 -04:00
|
|
|
expected = os.__doc__.splitlines()[0]
|
2022-10-06 19:40:22 -03:00
|
|
|
filename = os.__spec__.cached
|
2014-01-04 23:38:11 -04:00
|
|
|
synopsis = pydoc.synopsis(filename)
|
|
|
|
|
|
|
|
self.assertEqual(synopsis, expected)
|
|
|
|
|
2015-02-16 20:45:01 -04:00
|
|
|
def test_synopsis_sourceless_empty_doc(self):
|
2020-08-03 13:47:42 -03:00
|
|
|
with os_helper.temp_cwd() as test_dir:
|
2015-02-16 20:45:01 -04:00
|
|
|
init_path = os.path.join(test_dir, 'foomod42.py')
|
|
|
|
cached_path = importlib.util.cache_from_source(init_path)
|
|
|
|
with open(init_path, 'w') as fobj:
|
|
|
|
fobj.write("foo = 1")
|
|
|
|
py_compile.compile(init_path)
|
|
|
|
synopsis = pydoc.synopsis(init_path, {})
|
|
|
|
self.assertIsNone(synopsis)
|
|
|
|
synopsis_cached = pydoc.synopsis(cached_path, {})
|
|
|
|
self.assertIsNone(synopsis_cached)
|
|
|
|
|
2013-03-19 01:00:33 -03:00
|
|
|
def test_splitdoc_with_description(self):
|
|
|
|
example_string = "I Am A Doc\n\n\nHere is my description"
|
|
|
|
self.assertEqual(pydoc.splitdoc(example_string),
|
|
|
|
('I Am A Doc', '\nHere is my description'))
|
|
|
|
|
|
|
|
def test_is_package_when_not_package(self):
|
2020-08-03 13:47:42 -03:00
|
|
|
with os_helper.temp_cwd() as test_dir:
|
2023-12-27 10:04:31 -04:00
|
|
|
with self.assertWarns(DeprecationWarning) as cm:
|
|
|
|
self.assertFalse(pydoc.ispackage(test_dir))
|
|
|
|
self.assertEqual(cm.filename, __file__)
|
2013-03-19 01:00:33 -03:00
|
|
|
|
|
|
|
def test_is_package_when_is_package(self):
|
2020-08-03 13:47:42 -03:00
|
|
|
with os_helper.temp_cwd() as test_dir:
|
2013-03-19 01:00:33 -03:00
|
|
|
init_path = os.path.join(test_dir, '__init__.py')
|
|
|
|
open(init_path, 'w').close()
|
2023-12-27 10:04:31 -04:00
|
|
|
with self.assertWarns(DeprecationWarning) as cm:
|
|
|
|
self.assertTrue(pydoc.ispackage(test_dir))
|
2013-03-19 01:00:33 -03:00
|
|
|
os.remove(init_path)
|
2023-12-27 10:04:31 -04:00
|
|
|
self.assertEqual(cm.filename, __file__)
|
2013-03-19 01:00:33 -03:00
|
|
|
|
2013-03-19 03:47:44 -03:00
|
|
|
def test_allmethods(self):
|
|
|
|
# issue 17476: allmethods was no longer returning unbound methods.
|
|
|
|
# This test is a bit fragile in the face of changes to object and type,
|
|
|
|
# but I can't think of a better way to do it without duplicating the
|
|
|
|
# logic of the function under test.
|
|
|
|
|
|
|
|
class TestClass(object):
|
|
|
|
def method_returning_true(self):
|
|
|
|
return True
|
|
|
|
|
|
|
|
# What we expect to get back: everything on object...
|
|
|
|
expected = dict(vars(object))
|
|
|
|
# ...plus our unbound method...
|
|
|
|
expected['method_returning_true'] = TestClass.method_returning_true
|
|
|
|
# ...but not the non-methods on object.
|
|
|
|
del expected['__doc__']
|
|
|
|
del expected['__class__']
|
|
|
|
# inspect resolves descriptors on type into methods, but vars doesn't,
|
2016-07-30 03:26:03 -03:00
|
|
|
# so we need to update __subclasshook__ and __init_subclass__.
|
2013-03-19 03:47:44 -03:00
|
|
|
expected['__subclasshook__'] = TestClass.__subclasshook__
|
2016-07-30 03:26:03 -03:00
|
|
|
expected['__init_subclass__'] = TestClass.__init_subclass__
|
2013-03-19 03:47:44 -03:00
|
|
|
|
|
|
|
methods = pydoc.allmethods(TestClass)
|
|
|
|
self.assertDictEqual(methods, expected)
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2018-11-08 02:48:11 -04:00
|
|
|
def test_method_aliases(self):
|
|
|
|
class A:
|
|
|
|
def tkraise(self, aboveThis=None):
|
|
|
|
"""Raise this widget in the stacking order."""
|
|
|
|
lift = tkraise
|
|
|
|
def a_size(self):
|
|
|
|
"""Return size"""
|
|
|
|
class B(A):
|
|
|
|
def itemconfigure(self, tagOrId, cnf=None, **kw):
|
|
|
|
"""Configure resources of an item TAGORID."""
|
|
|
|
itemconfig = itemconfigure
|
|
|
|
b_size = A.a_size
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(B)
|
2024-02-11 09:19:44 -04:00
|
|
|
doc = clean_text(doc)
|
2018-11-08 02:48:11 -04:00
|
|
|
self.assertEqual(doc, '''\
|
|
|
|
Python Library Documentation: class B in module %s
|
|
|
|
|
|
|
|
class B(A)
|
|
|
|
| Method resolution order:
|
|
|
|
| B
|
|
|
|
| A
|
|
|
|
| builtins.object
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| Methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| b_size = a_size(self)
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| itemconfig = itemconfigure(self, tagOrId, cnf=None, **kw)
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| itemconfigure(self, tagOrId, cnf=None, **kw)
|
|
|
|
| Configure resources of an item TAGORID.
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Methods inherited from A:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| a_size(self)
|
|
|
|
| Return size
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| lift = tkraise(self, aboveThis=None)
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| tkraise(self, aboveThis=None)
|
|
|
|
| Raise this widget in the stacking order.
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data descriptors inherited from A:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| __dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
| dictionary for instance variables
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2018-11-08 02:48:11 -04:00
|
|
|
| __weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
| list of weak references to the object
|
2018-11-08 02:48:11 -04:00
|
|
|
''' % __name__)
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(B, renderer=pydoc.HTMLDoc())
|
2021-11-07 19:44:11 -04:00
|
|
|
expected_text = f"""
|
2021-10-09 04:36:50 -03:00
|
|
|
Python Library Documentation
|
2018-11-08 02:48:11 -04:00
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
class B in module {__name__}
|
2021-10-09 04:36:50 -03:00
|
|
|
class B(A)
|
|
|
|
Method resolution order:
|
|
|
|
B
|
|
|
|
A
|
|
|
|
builtins.object
|
|
|
|
|
|
|
|
Methods defined here:
|
|
|
|
b_size = a_size(self)
|
|
|
|
itemconfig = itemconfigure(self, tagOrId, cnf=None, **kw)
|
|
|
|
itemconfigure(self, tagOrId, cnf=None, **kw)
|
|
|
|
Configure resources of an item TAGORID.
|
|
|
|
|
|
|
|
Methods inherited from A:
|
|
|
|
a_size(self)
|
|
|
|
Return size
|
|
|
|
lift = tkraise(self, aboveThis=None)
|
|
|
|
tkraise(self, aboveThis=None)
|
|
|
|
Raise this widget in the stacking order.
|
|
|
|
|
|
|
|
Data descriptors inherited from A:
|
|
|
|
__dict__
|
2023-11-19 14:30:07 -04:00
|
|
|
dictionary for instance variables
|
2021-10-09 04:36:50 -03:00
|
|
|
__weakref__
|
2023-11-19 14:30:07 -04:00
|
|
|
list of weak references to the object
|
2021-10-09 04:36:50 -03:00
|
|
|
"""
|
|
|
|
as_text = html2text(doc)
|
|
|
|
expected_lines = [line.strip() for line in expected_text.split("\n") if line]
|
|
|
|
for expected_line in expected_lines:
|
|
|
|
self.assertIn(expected_line, as_text)
|
2018-11-08 02:48:11 -04:00
|
|
|
|
2023-12-02 19:39:43 -04:00
|
|
|
def test_long_signatures(self):
|
|
|
|
from collections.abc import Callable
|
|
|
|
from typing import Literal, Annotated
|
|
|
|
|
|
|
|
class A:
|
|
|
|
def __init__(self,
|
|
|
|
arg1: Callable[[int, int, int], str],
|
|
|
|
arg2: Literal['some value', 'other value'],
|
|
|
|
arg3: Annotated[int, 'some docs about this type'],
|
|
|
|
) -> None:
|
|
|
|
...
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(A)
|
2024-02-11 09:19:44 -04:00
|
|
|
doc = clean_text(doc)
|
2023-12-02 19:39:43 -04:00
|
|
|
self.assertEqual(doc, '''Python Library Documentation: class A in module %s
|
|
|
|
|
|
|
|
class A(builtins.object)
|
|
|
|
| A(
|
|
|
|
| arg1: collections.abc.Callable[[int, int, int], str],
|
|
|
|
| arg2: Literal['some value', 'other value'],
|
|
|
|
| arg3: Annotated[int, 'some docs about this type']
|
|
|
|
| ) -> None
|
|
|
|
|
|
|
|
|
| Methods defined here:
|
|
|
|
|
|
|
|
|
| __init__(
|
|
|
|
| self,
|
|
|
|
| arg1: collections.abc.Callable[[int, int, int], str],
|
|
|
|
| arg2: Literal['some value', 'other value'],
|
|
|
|
| arg3: Annotated[int, 'some docs about this type']
|
|
|
|
| ) -> None
|
|
|
|
|
|
|
|
|
| ----------------------------------------------------------------------
|
|
|
|
| Data descriptors defined here:
|
|
|
|
|
|
2023-12-23 05:56:30 -04:00
|
|
|
| __dict__%s
|
2023-12-02 19:39:43 -04:00
|
|
|
|
|
2023-12-23 05:56:30 -04:00
|
|
|
| __weakref__%s
|
|
|
|
''' % (__name__,
|
|
|
|
'' if MISSING_C_DOCSTRINGS else '\n | dictionary for instance variables',
|
|
|
|
'' if MISSING_C_DOCSTRINGS else '\n | list of weak references to the object',
|
|
|
|
))
|
2023-12-02 19:39:43 -04:00
|
|
|
|
|
|
|
def func(
|
|
|
|
arg1: Callable[[Annotated[int, 'Some doc']], str],
|
|
|
|
arg2: Literal[1, 2, 3, 4, 5, 6, 7, 8],
|
|
|
|
) -> Annotated[int, 'Some other']:
|
|
|
|
...
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(func)
|
2024-02-11 09:19:44 -04:00
|
|
|
doc = clean_text(doc)
|
2023-12-02 19:39:43 -04:00
|
|
|
self.assertEqual(doc, '''Python Library Documentation: function func in module %s
|
|
|
|
|
|
|
|
func(
|
|
|
|
arg1: collections.abc.Callable[[typing.Annotated[int, 'Some doc']], str],
|
|
|
|
arg2: Literal[1, 2, 3, 4, 5, 6, 7, 8]
|
|
|
|
) -> Annotated[int, 'Some other']
|
|
|
|
''' % __name__)
|
|
|
|
|
|
|
|
def function_with_really_long_name_so_annotations_can_be_rather_small(
|
|
|
|
arg1: int,
|
|
|
|
arg2: str,
|
|
|
|
):
|
|
|
|
...
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(function_with_really_long_name_so_annotations_can_be_rather_small)
|
2024-02-11 09:19:44 -04:00
|
|
|
doc = clean_text(doc)
|
2023-12-02 19:39:43 -04:00
|
|
|
self.assertEqual(doc, '''Python Library Documentation: function function_with_really_long_name_so_annotations_can_be_rather_small in module %s
|
|
|
|
|
|
|
|
function_with_really_long_name_so_annotations_can_be_rather_small(
|
|
|
|
arg1: int,
|
|
|
|
arg2: str
|
|
|
|
)
|
|
|
|
''' % __name__)
|
|
|
|
|
|
|
|
does_not_have_name = lambda \
|
|
|
|
very_long_parameter_name_that_should_not_fit_into_a_single_line, \
|
|
|
|
second_very_long_parameter_name: ...
|
|
|
|
|
|
|
|
doc = pydoc.render_doc(does_not_have_name)
|
2024-02-11 09:19:44 -04:00
|
|
|
doc = clean_text(doc)
|
2023-12-02 19:39:43 -04:00
|
|
|
self.assertEqual(doc, '''Python Library Documentation: function <lambda> in module %s
|
|
|
|
|
|
|
|
<lambda> lambda very_long_parameter_name_that_should_not_fit_into_a_single_line, second_very_long_parameter_name
|
|
|
|
''' % __name__)
|
|
|
|
|
2022-03-29 19:07:15 -03:00
|
|
|
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)
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2013-05-19 10:44:54 -03:00
|
|
|
class PydocImportTest(PydocBaseTest):
|
2011-10-06 18:19:03 -03:00
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.test_dir = os.mkdir(TESTFN)
|
|
|
|
self.addCleanup(rmtree, TESTFN)
|
2015-02-16 20:45:01 -04:00
|
|
|
importlib.invalidate_caches()
|
2011-10-06 18:19:03 -03:00
|
|
|
|
|
|
|
def test_badimport(self):
|
|
|
|
# This tests the fix for issue 5230, where if pydoc found the module
|
|
|
|
# but the module had an internal import error pydoc would report no doc
|
|
|
|
# found.
|
|
|
|
modname = 'testmod_xyzzy'
|
|
|
|
testpairs = (
|
|
|
|
('i_am_not_here', 'i_am_not_here'),
|
2012-04-14 15:10:13 -03:00
|
|
|
('test.i_am_not_here_either', 'test.i_am_not_here_either'),
|
|
|
|
('test.i_am_not_here.neither_am_i', 'test.i_am_not_here'),
|
|
|
|
('i_am_not_here.{}'.format(modname), 'i_am_not_here'),
|
|
|
|
('test.{}'.format(modname), 'test.{}'.format(modname)),
|
2011-10-06 18:19:03 -03:00
|
|
|
)
|
|
|
|
|
|
|
|
sourcefn = os.path.join(TESTFN, modname) + os.extsep + "py"
|
|
|
|
for importstring, expectedinmsg in testpairs:
|
|
|
|
with open(sourcefn, 'w') as f:
|
|
|
|
f.write("import {}\n".format(importstring))
|
2021-08-26 09:22:02 -03:00
|
|
|
result = run_pydoc_fail(modname, PYTHONPATH=TESTFN).decode("ascii")
|
2011-10-06 18:19:03 -03:00
|
|
|
expected = badimport_pattern % (modname, expectedinmsg)
|
|
|
|
self.assertEqual(expected, result)
|
|
|
|
|
|
|
|
def test_apropos_with_bad_package(self):
|
|
|
|
# Issue 7425 - pydoc -k failed when bad package on path
|
|
|
|
pkgdir = os.path.join(TESTFN, "syntaxerr")
|
|
|
|
os.mkdir(pkgdir)
|
|
|
|
badsyntax = os.path.join(pkgdir, "__init__") + os.extsep + "py"
|
|
|
|
with open(badsyntax, 'w') as f:
|
|
|
|
f.write("invalid python syntax = $1\n")
|
2013-05-19 10:44:54 -03:00
|
|
|
with self.restrict_walk_packages(path=[TESTFN]):
|
|
|
|
with captured_stdout() as out:
|
|
|
|
with captured_stderr() as err:
|
|
|
|
pydoc.apropos('xyzzy')
|
|
|
|
# No result, no error
|
|
|
|
self.assertEqual(out.getvalue(), '')
|
|
|
|
self.assertEqual(err.getvalue(), '')
|
|
|
|
# The package name is still matched
|
|
|
|
with captured_stdout() as out:
|
|
|
|
with captured_stderr() as err:
|
|
|
|
pydoc.apropos('syntaxerr')
|
|
|
|
self.assertEqual(out.getvalue().strip(), 'syntaxerr')
|
|
|
|
self.assertEqual(err.getvalue(), '')
|
2011-10-06 18:19:03 -03:00
|
|
|
|
|
|
|
def test_apropos_with_unreadable_dir(self):
|
|
|
|
# Issue 7367 - pydoc -k failed when unreadable dir on path
|
|
|
|
self.unreadable_dir = os.path.join(TESTFN, "unreadable")
|
|
|
|
os.mkdir(self.unreadable_dir, 0)
|
|
|
|
self.addCleanup(os.rmdir, self.unreadable_dir)
|
|
|
|
# Note, on Windows the directory appears to be still
|
|
|
|
# readable so this is not really testing the issue there
|
2013-05-19 10:44:54 -03:00
|
|
|
with self.restrict_walk_packages(path=[TESTFN]):
|
|
|
|
with captured_stdout() as out:
|
|
|
|
with captured_stderr() as err:
|
|
|
|
pydoc.apropos('SOMEKEY')
|
|
|
|
# No result, no error
|
|
|
|
self.assertEqual(out.getvalue(), '')
|
|
|
|
self.assertEqual(err.getvalue(), '')
|
2011-10-06 18:19:03 -03:00
|
|
|
|
2022-06-06 14:24:11 -03:00
|
|
|
@os_helper.skip_unless_working_chmod
|
2022-06-19 13:28:55 -03:00
|
|
|
@unittest.skipIf(is_emscripten, "cannot remove x bit")
|
2015-02-16 20:45:01 -04:00
|
|
|
def test_apropos_empty_doc(self):
|
|
|
|
pkgdir = os.path.join(TESTFN, 'walkpkg')
|
|
|
|
os.mkdir(pkgdir)
|
|
|
|
self.addCleanup(rmtree, pkgdir)
|
|
|
|
init_path = os.path.join(pkgdir, '__init__.py')
|
|
|
|
with open(init_path, 'w') as fobj:
|
|
|
|
fobj.write("foo = 1")
|
|
|
|
current_mode = stat.S_IMODE(os.stat(pkgdir).st_mode)
|
|
|
|
try:
|
|
|
|
os.chmod(pkgdir, current_mode & ~stat.S_IEXEC)
|
|
|
|
with self.restrict_walk_packages(path=[TESTFN]), captured_stdout() as stdout:
|
|
|
|
pydoc.apropos('')
|
|
|
|
self.assertIn('walkpkg', stdout.getvalue())
|
|
|
|
finally:
|
|
|
|
os.chmod(pkgdir, current_mode)
|
|
|
|
|
2015-11-05 20:27:14 -04:00
|
|
|
def test_url_search_package_error(self):
|
|
|
|
# URL handler search should cope with packages that raise exceptions
|
|
|
|
pkgdir = os.path.join(TESTFN, "test_error_package")
|
|
|
|
os.mkdir(pkgdir)
|
|
|
|
init = os.path.join(pkgdir, "__init__.py")
|
|
|
|
with open(init, "wt", encoding="ascii") as f:
|
|
|
|
f.write("""raise ValueError("ouch")\n""")
|
|
|
|
with self.restrict_walk_packages(path=[TESTFN]):
|
|
|
|
# Package has to be importable for the error to have any effect
|
|
|
|
saved_paths = tuple(sys.path)
|
|
|
|
sys.path.insert(0, TESTFN)
|
|
|
|
try:
|
|
|
|
with self.assertRaisesRegex(ValueError, "ouch"):
|
2024-06-18 12:51:47 -03:00
|
|
|
# Sanity check
|
|
|
|
import test_error_package # noqa: F401
|
2015-11-05 20:27:14 -04:00
|
|
|
|
|
|
|
text = self.call_url_handler("search?key=test_error_package",
|
|
|
|
"Pydoc: Search Results")
|
|
|
|
found = ('<a href="test_error_package.html">'
|
|
|
|
'test_error_package</a>')
|
|
|
|
self.assertIn(found, text)
|
|
|
|
finally:
|
|
|
|
sys.path[:] = saved_paths
|
|
|
|
|
2016-05-26 02:35:26 -03:00
|
|
|
@unittest.skip('causes undesirable side-effects (#20128)')
|
2014-01-04 23:38:11 -04:00
|
|
|
def test_modules(self):
|
|
|
|
# See Helper.listmodules().
|
|
|
|
num_header_lines = 2
|
|
|
|
num_module_lines_min = 5 # Playing it safe.
|
|
|
|
num_footer_lines = 3
|
|
|
|
expected = num_header_lines + num_module_lines_min + num_footer_lines
|
|
|
|
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper('modules')
|
|
|
|
result = output.getvalue().strip()
|
|
|
|
num_lines = len(result.splitlines())
|
|
|
|
|
|
|
|
self.assertGreaterEqual(num_lines, expected)
|
|
|
|
|
2016-05-26 02:35:26 -03:00
|
|
|
@unittest.skip('causes undesirable side-effects (#20128)')
|
2014-01-04 23:38:11 -04:00
|
|
|
def test_modules_search(self):
|
|
|
|
# See Helper.listmodules().
|
|
|
|
expected = 'pydoc - '
|
|
|
|
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
with captured_stdout() as help_io:
|
|
|
|
helper('modules pydoc')
|
|
|
|
result = help_io.getvalue()
|
|
|
|
|
|
|
|
self.assertIn(expected, result)
|
|
|
|
|
2014-02-22 16:57:08 -04:00
|
|
|
@unittest.skip('some buildbots are not cooperating (#20128)')
|
2014-01-04 23:38:11 -04:00
|
|
|
def test_modules_search_builtin(self):
|
2014-01-05 02:04:27 -04:00
|
|
|
expected = 'gc - '
|
2014-01-04 23:38:11 -04:00
|
|
|
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
with captured_stdout() as help_io:
|
2014-01-05 02:04:27 -04:00
|
|
|
helper('modules garbage')
|
2014-01-04 23:38:11 -04:00
|
|
|
result = help_io.getvalue()
|
|
|
|
|
|
|
|
self.assertTrue(result.startswith(expected))
|
|
|
|
|
|
|
|
def test_importfile(self):
|
2024-06-18 06:19:32 -03:00
|
|
|
try:
|
|
|
|
loaded_pydoc = pydoc.importfile(pydoc.__file__)
|
2014-01-04 23:38:11 -04:00
|
|
|
|
2024-06-18 06:19:32 -03:00
|
|
|
self.assertIsNot(loaded_pydoc, pydoc)
|
|
|
|
self.assertEqual(loaded_pydoc.__name__, 'pydoc')
|
|
|
|
self.assertEqual(loaded_pydoc.__file__, pydoc.__file__)
|
|
|
|
self.assertEqual(loaded_pydoc.__spec__, pydoc.__spec__)
|
|
|
|
finally:
|
|
|
|
sys.modules['pydoc'] = pydoc
|
2014-01-04 23:38:11 -04:00
|
|
|
|
2011-10-06 18:19:03 -03:00
|
|
|
|
2024-02-20 11:14:34 -04:00
|
|
|
class Rect:
|
|
|
|
@property
|
|
|
|
def area(self):
|
|
|
|
'''Area of the rect'''
|
|
|
|
return self.w * self.h
|
|
|
|
|
|
|
|
|
|
|
|
class Square(Rect):
|
|
|
|
area = property(lambda self: self.side**2)
|
|
|
|
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
class TestDescriptions(unittest.TestCase):
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
def test_module(self):
|
|
|
|
# Check that pydocfodder module can be described
|
|
|
|
doc = pydoc.render_doc(pydocfodder)
|
2010-01-18 20:09:57 -04:00
|
|
|
self.assertIn("pydocfodder", doc)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
def test_class(self):
|
2010-12-03 05:29:11 -04:00
|
|
|
class C: "New-style class"
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
c = C()
|
|
|
|
|
|
|
|
self.assertEqual(pydoc.describe(C), 'class C')
|
|
|
|
self.assertEqual(pydoc.describe(c), 'C')
|
|
|
|
expected = 'C in module %s object' % __name__
|
2010-01-18 20:09:57 -04:00
|
|
|
self.assertIn(expected, pydoc.render_doc(c))
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2022-03-18 06:05:18 -03:00
|
|
|
def test_generic_alias(self):
|
|
|
|
self.assertEqual(pydoc.describe(typing.List[int]), '_GenericAlias')
|
|
|
|
doc = pydoc.render_doc(typing.List[int], renderer=pydoc.plaintext)
|
|
|
|
self.assertIn('_GenericAlias in module typing', doc)
|
|
|
|
self.assertIn('List = class list(object)', doc)
|
2023-12-23 05:56:30 -04:00
|
|
|
if not MISSING_C_DOCSTRINGS:
|
|
|
|
self.assertIn(list.__doc__.strip().splitlines()[0], doc)
|
2022-03-18 06:05:18 -03:00
|
|
|
|
|
|
|
self.assertEqual(pydoc.describe(list[int]), 'GenericAlias')
|
|
|
|
doc = pydoc.render_doc(list[int], renderer=pydoc.plaintext)
|
|
|
|
self.assertIn('GenericAlias in module builtins', doc)
|
|
|
|
self.assertIn('\nclass list(object)', doc)
|
2023-12-23 05:56:30 -04:00
|
|
|
if not MISSING_C_DOCSTRINGS:
|
|
|
|
self.assertIn(list.__doc__.strip().splitlines()[0], doc)
|
2022-03-18 06:05:18 -03:00
|
|
|
|
|
|
|
def test_union_type(self):
|
|
|
|
self.assertEqual(pydoc.describe(typing.Union[int, str]), '_UnionGenericAlias')
|
|
|
|
doc = pydoc.render_doc(typing.Union[int, str], renderer=pydoc.plaintext)
|
|
|
|
self.assertIn('_UnionGenericAlias in module typing', doc)
|
|
|
|
self.assertIn('Union = typing.Union', doc)
|
|
|
|
if typing.Union.__doc__:
|
|
|
|
self.assertIn(typing.Union.__doc__.strip().splitlines()[0], doc)
|
|
|
|
|
|
|
|
self.assertEqual(pydoc.describe(int | str), 'UnionType')
|
|
|
|
doc = pydoc.render_doc(int | str, renderer=pydoc.plaintext)
|
|
|
|
self.assertIn('UnionType in module types object', doc)
|
|
|
|
self.assertIn('\nclass UnionType(builtins.object)', doc)
|
2023-12-23 05:56:30 -04:00
|
|
|
if not MISSING_C_DOCSTRINGS:
|
|
|
|
self.assertIn(types.UnionType.__doc__.strip().splitlines()[0], doc)
|
2022-03-18 06:05:18 -03:00
|
|
|
|
|
|
|
def test_special_form(self):
|
2022-04-04 23:35:29 -03:00
|
|
|
self.assertEqual(pydoc.describe(typing.NoReturn), '_SpecialForm')
|
|
|
|
doc = pydoc.render_doc(typing.NoReturn, renderer=pydoc.plaintext)
|
2022-03-18 06:05:18 -03:00
|
|
|
self.assertIn('_SpecialForm in module typing', doc)
|
2022-04-04 23:35:29 -03:00
|
|
|
if typing.NoReturn.__doc__:
|
|
|
|
self.assertIn('NoReturn = typing.NoReturn', doc)
|
|
|
|
self.assertIn(typing.NoReturn.__doc__.strip().splitlines()[0], doc)
|
2022-03-18 06:05:18 -03:00
|
|
|
else:
|
2022-04-04 23:35:29 -03:00
|
|
|
self.assertIn('NoReturn = class _SpecialForm(_Final)', doc)
|
2022-03-18 06:05:18 -03:00
|
|
|
|
2016-10-22 11:55:18 -03:00
|
|
|
def test_typing_pydoc(self):
|
|
|
|
def foo(data: typing.List[typing.Any],
|
|
|
|
x: int) -> typing.Iterator[typing.Tuple[int, typing.Any]]:
|
|
|
|
...
|
|
|
|
T = typing.TypeVar('T')
|
|
|
|
class C(typing.Generic[T], typing.Mapping[int, str]): ...
|
|
|
|
self.assertEqual(pydoc.render_doc(foo).splitlines()[-1],
|
2017-11-15 14:30:59 -04:00
|
|
|
'f\x08fo\x08oo\x08o(data: List[Any], x: int)'
|
2016-10-22 11:55:18 -03:00
|
|
|
' -> Iterator[Tuple[int, Any]]')
|
|
|
|
self.assertEqual(pydoc.render_doc(C).splitlines()[2],
|
2018-01-20 07:23:59 -04:00
|
|
|
'class C\x08C(collections.abc.Mapping, typing.Generic)')
|
2016-10-22 11:55:18 -03:00
|
|
|
|
2011-07-29 12:03:55 -03:00
|
|
|
def test_builtin(self):
|
|
|
|
for name in ('str', 'str.translate', 'builtins.str',
|
|
|
|
'builtins.str.translate'):
|
|
|
|
# test low-level function
|
|
|
|
self.assertIsNotNone(pydoc.locate(name))
|
|
|
|
# test high-level function
|
|
|
|
try:
|
|
|
|
pydoc.render_doc(name)
|
|
|
|
except ImportError:
|
2014-06-20 15:59:11 -03:00
|
|
|
self.fail('finding the doc of {!r} failed'.format(name))
|
2011-07-29 12:03:55 -03:00
|
|
|
|
|
|
|
for name in ('notbuiltins', 'strrr', 'strr.translate',
|
|
|
|
'str.trrrranslate', 'builtins.strrr',
|
|
|
|
'builtins.str.trrranslate'):
|
|
|
|
self.assertIsNone(pydoc.locate(name))
|
|
|
|
self.assertRaises(ImportError, pydoc.render_doc, name)
|
|
|
|
|
2014-02-21 03:34:46 -04:00
|
|
|
@staticmethod
|
|
|
|
def _get_summary_line(o):
|
|
|
|
text = pydoc.plain(pydoc.render_doc(o))
|
|
|
|
lines = text.split('\n')
|
|
|
|
assert len(lines) >= 2
|
|
|
|
return lines[2]
|
|
|
|
|
2019-01-15 04:53:18 -04:00
|
|
|
@staticmethod
|
|
|
|
def _get_summary_lines(o):
|
|
|
|
text = pydoc.plain(pydoc.render_doc(o))
|
|
|
|
lines = text.split('\n')
|
|
|
|
return '\n'.join(lines[2:])
|
|
|
|
|
2014-02-21 03:34:46 -04:00
|
|
|
# these should include "self"
|
|
|
|
def test_unbound_python_method(self):
|
|
|
|
self.assertEqual(self._get_summary_line(textwrap.TextWrapper.wrap),
|
|
|
|
"wrap(self, text)")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_unbound_builtin_method(self):
|
|
|
|
self.assertEqual(self._get_summary_line(_pickle.Pickler.dump),
|
2024-02-11 09:19:44 -04:00
|
|
|
"dump(self, obj, /) unbound _pickle.Pickler method")
|
2014-02-21 03:34:46 -04:00
|
|
|
|
|
|
|
# these no longer include "self"
|
|
|
|
def test_bound_python_method(self):
|
|
|
|
t = textwrap.TextWrapper()
|
|
|
|
self.assertEqual(self._get_summary_line(t.wrap),
|
|
|
|
"wrap(text) method of textwrap.TextWrapper instance")
|
2015-08-19 02:25:16 -03:00
|
|
|
def test_field_order_for_named_tuples(self):
|
|
|
|
Person = namedtuple('Person', ['nickname', 'firstname', 'agegroup'])
|
|
|
|
s = pydoc.render_doc(Person)
|
|
|
|
self.assertLess(s.index('nickname'), s.index('firstname'))
|
|
|
|
self.assertLess(s.index('firstname'), s.index('agegroup'))
|
|
|
|
|
|
|
|
class NonIterableFields:
|
|
|
|
_fields = None
|
|
|
|
|
|
|
|
class NonHashableFields:
|
|
|
|
_fields = [[]]
|
|
|
|
|
|
|
|
# Make sure these doesn't fail
|
|
|
|
pydoc.render_doc(NonIterableFields)
|
|
|
|
pydoc.render_doc(NonHashableFields)
|
|
|
|
|
2014-02-21 03:34:46 -04:00
|
|
|
@requires_docstrings
|
|
|
|
def test_bound_builtin_method(self):
|
|
|
|
s = StringIO()
|
|
|
|
p = _pickle.Pickler(s)
|
|
|
|
self.assertEqual(self._get_summary_line(p.dump),
|
|
|
|
"dump(obj, /) method of _pickle.Pickler instance")
|
|
|
|
|
|
|
|
# this should *never* include self!
|
2014-01-18 18:18:39 -04:00
|
|
|
@requires_docstrings
|
2014-02-21 03:34:46 -04:00
|
|
|
def test_module_level_callable(self):
|
|
|
|
self.assertEqual(self._get_summary_line(os.stat),
|
|
|
|
"stat(path, *, dir_fd=None, follow_symlinks=True)")
|
2014-01-16 18:15:03 -04:00
|
|
|
|
2023-08-11 12:08:38 -03:00
|
|
|
def test_module_level_callable_noargs(self):
|
|
|
|
self.assertEqual(self._get_summary_line(time.time),
|
|
|
|
"time()")
|
|
|
|
|
|
|
|
def test_module_level_callable_o(self):
|
2023-08-31 18:14:23 -03:00
|
|
|
try:
|
|
|
|
import _stat
|
|
|
|
except ImportError:
|
|
|
|
# stat.S_IMODE() and _stat.S_IMODE() have a different signature
|
|
|
|
self.skipTest('_stat extension is missing')
|
|
|
|
|
|
|
|
self.assertEqual(self._get_summary_line(_stat.S_IMODE),
|
2023-08-11 12:08:38 -03:00
|
|
|
"S_IMODE(object, /)")
|
|
|
|
|
|
|
|
def test_unbound_builtin_method_noargs(self):
|
|
|
|
self.assertEqual(self._get_summary_line(str.lower),
|
2024-02-11 09:19:44 -04:00
|
|
|
"lower(self, /) unbound builtins.str method")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_bound_builtin_method_noargs(self):
|
|
|
|
self.assertEqual(self._get_summary_line(''.lower),
|
|
|
|
"lower() method of builtins.str instance")
|
|
|
|
|
|
|
|
def test_unbound_builtin_method_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(set.add),
|
2024-02-11 09:19:44 -04:00
|
|
|
"add(self, object, /) unbound builtins.set method")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_bound_builtin_method_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(set().add),
|
|
|
|
"add(object, /) method of builtins.set instance")
|
|
|
|
|
|
|
|
def test_unbound_builtin_method_coexist_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(set.__contains__),
|
2024-02-11 09:19:44 -04:00
|
|
|
"__contains__(self, object, /) unbound builtins.set method")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_bound_builtin_method_coexist_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(set().__contains__),
|
|
|
|
"__contains__(object, /) method of builtins.set instance")
|
|
|
|
|
|
|
|
def test_unbound_builtin_classmethod_noargs(self):
|
|
|
|
self.assertEqual(self._get_summary_line(datetime.datetime.__dict__['utcnow']),
|
2024-02-11 09:19:44 -04:00
|
|
|
"utcnow(type, /) unbound datetime.datetime method")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_bound_builtin_classmethod_noargs(self):
|
|
|
|
self.assertEqual(self._get_summary_line(datetime.datetime.utcnow),
|
2024-02-11 09:19:44 -04:00
|
|
|
"utcnow() class method of datetime.datetime")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_unbound_builtin_classmethod_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(dict.__dict__['__class_getitem__']),
|
2024-02-11 09:19:44 -04:00
|
|
|
"__class_getitem__(type, object, /) unbound builtins.dict method")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
|
|
|
def test_bound_builtin_classmethod_o(self):
|
|
|
|
self.assertEqual(self._get_summary_line(dict.__class_getitem__),
|
2024-02-11 09:19:44 -04:00
|
|
|
"__class_getitem__(object, /) class method of builtins.dict")
|
2023-08-11 12:08:38 -03:00
|
|
|
|
2023-09-14 03:12:17 -03:00
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-08-11 14:51:36 -03:00
|
|
|
def test_module_level_callable_unrepresentable_default(self):
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
builtin = _testcapi.func_with_unrepresentable_signature
|
|
|
|
self.assertEqual(self._get_summary_line(builtin),
|
|
|
|
"func_with_unrepresentable_signature(a, b=<x>)")
|
2023-08-11 14:51:36 -03:00
|
|
|
|
2023-09-14 03:12:17 -03:00
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-08-11 14:51:36 -03:00
|
|
|
def test_builtin_staticmethod_unrepresentable_default(self):
|
|
|
|
self.assertEqual(self._get_summary_line(str.maketrans),
|
|
|
|
"maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)")
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
cls = _testcapi.DocStringUnrepresentableSignatureTest
|
|
|
|
self.assertEqual(self._get_summary_line(cls.staticmeth),
|
|
|
|
"staticmeth(a, b=<x>)")
|
2023-08-11 14:51:36 -03:00
|
|
|
|
2023-09-14 03:12:17 -03:00
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-08-11 14:51:36 -03:00
|
|
|
def test_unbound_builtin_method_unrepresentable_default(self):
|
|
|
|
self.assertEqual(self._get_summary_line(dict.pop),
|
2024-02-11 09:19:44 -04:00
|
|
|
"pop(self, key, default=<unrepresentable>, /) "
|
|
|
|
"unbound builtins.dict method")
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
cls = _testcapi.DocStringUnrepresentableSignatureTest
|
|
|
|
self.assertEqual(self._get_summary_line(cls.meth),
|
2024-02-11 09:19:44 -04:00
|
|
|
"meth(self, /, a, b=<x>) unbound "
|
|
|
|
"_testcapi.DocStringUnrepresentableSignatureTest method")
|
2023-08-11 14:51:36 -03:00
|
|
|
|
2023-09-14 03:12:17 -03:00
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-08-11 14:51:36 -03:00
|
|
|
def test_bound_builtin_method_unrepresentable_default(self):
|
|
|
|
self.assertEqual(self._get_summary_line({}.pop),
|
|
|
|
"pop(key, default=<unrepresentable>, /) "
|
|
|
|
"method of builtins.dict instance")
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
obj = _testcapi.DocStringUnrepresentableSignatureTest()
|
|
|
|
self.assertEqual(self._get_summary_line(obj.meth),
|
|
|
|
"meth(a, b=<x>) "
|
|
|
|
"method of _testcapi.DocStringUnrepresentableSignatureTest instance")
|
|
|
|
|
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-09-14 03:12:17 -03:00
|
|
|
def test_unbound_builtin_classmethod_unrepresentable_default(self):
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
cls = _testcapi.DocStringUnrepresentableSignatureTest
|
|
|
|
descr = cls.__dict__['classmeth']
|
|
|
|
self.assertEqual(self._get_summary_line(descr),
|
2024-02-11 09:19:44 -04:00
|
|
|
"classmeth(type, /, a, b=<x>) unbound "
|
|
|
|
"_testcapi.DocStringUnrepresentableSignatureTest method")
|
2023-09-14 03:12:17 -03:00
|
|
|
|
|
|
|
@support.cpython_only
|
2023-12-23 05:56:30 -04:00
|
|
|
@requires_docstrings
|
2023-09-14 03:12:17 -03:00
|
|
|
def test_bound_builtin_classmethod_unrepresentable_default(self):
|
2024-04-03 10:11:36 -03:00
|
|
|
_testcapi = import_helper.import_module("_testcapi")
|
2023-09-14 03:12:17 -03:00
|
|
|
cls = _testcapi.DocStringUnrepresentableSignatureTest
|
|
|
|
self.assertEqual(self._get_summary_line(cls.classmeth),
|
2024-02-11 09:19:44 -04:00
|
|
|
"classmeth(a, b=<x>) class method of "
|
|
|
|
"_testcapi.DocStringUnrepresentableSignatureTest")
|
2023-08-11 14:51:36 -03:00
|
|
|
|
|
|
|
def test_overridden_text_signature(self):
|
|
|
|
class C:
|
|
|
|
def meth(*args, **kwargs):
|
|
|
|
pass
|
|
|
|
@classmethod
|
|
|
|
def cmeth(*args, **kwargs):
|
|
|
|
pass
|
|
|
|
@staticmethod
|
|
|
|
def smeth(*args, **kwargs):
|
|
|
|
pass
|
|
|
|
for text_signature, unbound, bound in [
|
|
|
|
("($slf)", "(slf, /)", "()"),
|
|
|
|
("($slf, /)", "(slf, /)", "()"),
|
|
|
|
("($slf, /, arg)", "(slf, /, arg)", "(arg)"),
|
|
|
|
("($slf, /, arg=<x>)", "(slf, /, arg=<x>)", "(arg=<x>)"),
|
|
|
|
("($slf, arg, /)", "(slf, arg, /)", "(arg, /)"),
|
|
|
|
("($slf, arg=<x>, /)", "(slf, arg=<x>, /)", "(arg=<x>, /)"),
|
|
|
|
("(/, slf, arg)", "(/, slf, arg)", "(/, slf, arg)"),
|
|
|
|
("(/, slf, arg=<x>)", "(/, slf, arg=<x>)", "(/, slf, arg=<x>)"),
|
|
|
|
("(slf, /, arg)", "(slf, /, arg)", "(arg)"),
|
|
|
|
("(slf, /, arg=<x>)", "(slf, /, arg=<x>)", "(arg=<x>)"),
|
|
|
|
("(slf, arg, /)", "(slf, arg, /)", "(arg, /)"),
|
|
|
|
("(slf, arg=<x>, /)", "(slf, arg=<x>, /)", "(arg=<x>, /)"),
|
|
|
|
]:
|
|
|
|
with self.subTest(text_signature):
|
|
|
|
C.meth.__text_signature__ = text_signature
|
|
|
|
self.assertEqual(self._get_summary_line(C.meth),
|
|
|
|
"meth" + unbound)
|
|
|
|
self.assertEqual(self._get_summary_line(C().meth),
|
2024-02-13 06:40:40 -04:00
|
|
|
"meth" + bound + " method of test.test_pydoc.test_pydoc.C instance")
|
2023-08-11 14:51:36 -03:00
|
|
|
C.cmeth.__func__.__text_signature__ = text_signature
|
|
|
|
self.assertEqual(self._get_summary_line(C.cmeth),
|
2024-02-13 06:40:40 -04:00
|
|
|
"cmeth" + bound + " class method of test.test_pydoc.test_pydoc.C")
|
2023-08-11 14:51:36 -03:00
|
|
|
C.smeth.__text_signature__ = text_signature
|
|
|
|
self.assertEqual(self._get_summary_line(C.smeth),
|
|
|
|
"smeth" + unbound)
|
|
|
|
|
2019-01-15 04:53:18 -04:00
|
|
|
@requires_docstrings
|
|
|
|
def test_staticmethod(self):
|
|
|
|
class X:
|
|
|
|
@staticmethod
|
|
|
|
def sm(x, y):
|
|
|
|
'''A static method'''
|
|
|
|
...
|
|
|
|
self.assertEqual(self._get_summary_lines(X.__dict__['sm']),
|
2021-04-11 19:21:22 -03:00
|
|
|
'sm(x, y)\n'
|
2021-04-09 12:51:22 -03:00
|
|
|
' A static method\n')
|
2019-01-15 04:53:18 -04:00
|
|
|
self.assertEqual(self._get_summary_lines(X.sm), """\
|
|
|
|
sm(x, y)
|
|
|
|
A static method
|
|
|
|
""")
|
|
|
|
self.assertIn("""
|
|
|
|
| Static methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2019-01-15 04:53:18 -04:00
|
|
|
| sm(x, y)
|
|
|
|
| A static method
|
|
|
|
""", pydoc.plain(pydoc.render_doc(X)))
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_classmethod(self):
|
|
|
|
class X:
|
|
|
|
@classmethod
|
|
|
|
def cm(cls, x):
|
|
|
|
'''A class method'''
|
|
|
|
...
|
|
|
|
self.assertEqual(self._get_summary_lines(X.__dict__['cm']),
|
2021-04-09 12:51:22 -03:00
|
|
|
'cm(...)\n'
|
|
|
|
' A class method\n')
|
2019-01-15 04:53:18 -04:00
|
|
|
self.assertEqual(self._get_summary_lines(X.cm), """\
|
2024-02-13 06:40:40 -04:00
|
|
|
cm(x) class method of test.test_pydoc.test_pydoc.X
|
2019-01-15 04:53:18 -04:00
|
|
|
A class method
|
|
|
|
""")
|
|
|
|
self.assertIn("""
|
|
|
|
| Class methods defined here:
|
2022-06-27 07:33:34 -03:00
|
|
|
|
|
2024-02-11 09:19:44 -04:00
|
|
|
| cm(x)
|
2019-01-15 04:53:18 -04:00
|
|
|
| A class method
|
|
|
|
""", pydoc.plain(pydoc.render_doc(X)))
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_getset_descriptor(self):
|
|
|
|
# Currently these attributes are implemented as getset descriptors
|
|
|
|
# in CPython.
|
|
|
|
self.assertEqual(self._get_summary_line(int.numerator), "numerator")
|
|
|
|
self.assertEqual(self._get_summary_line(float.real), "real")
|
|
|
|
self.assertEqual(self._get_summary_line(Exception.args), "args")
|
|
|
|
self.assertEqual(self._get_summary_line(memoryview.obj), "obj")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_member_descriptor(self):
|
|
|
|
# Currently these attributes are implemented as member descriptors
|
|
|
|
# in CPython.
|
|
|
|
self.assertEqual(self._get_summary_line(complex.real), "real")
|
|
|
|
self.assertEqual(self._get_summary_line(range.start), "start")
|
|
|
|
self.assertEqual(self._get_summary_line(slice.start), "start")
|
|
|
|
self.assertEqual(self._get_summary_line(property.fget), "fget")
|
|
|
|
self.assertEqual(self._get_summary_line(StopIteration.value), "value")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_slot_descriptor(self):
|
|
|
|
class Point:
|
|
|
|
__slots__ = 'x', 'y'
|
|
|
|
self.assertEqual(self._get_summary_line(Point.x), "x")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_dict_attr_descriptor(self):
|
|
|
|
class NS:
|
|
|
|
pass
|
|
|
|
self.assertEqual(self._get_summary_line(NS.__dict__['__dict__']),
|
|
|
|
"__dict__")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_structseq_member_descriptor(self):
|
|
|
|
self.assertEqual(self._get_summary_line(type(sys.hash_info).width),
|
|
|
|
"width")
|
|
|
|
self.assertEqual(self._get_summary_line(type(sys.flags).debug),
|
|
|
|
"debug")
|
|
|
|
self.assertEqual(self._get_summary_line(type(sys.version_info).major),
|
|
|
|
"major")
|
|
|
|
self.assertEqual(self._get_summary_line(type(sys.float_info).max),
|
|
|
|
"max")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_namedtuple_field_descriptor(self):
|
|
|
|
Box = namedtuple('Box', ('width', 'height'))
|
|
|
|
self.assertEqual(self._get_summary_lines(Box.width), """\
|
|
|
|
Alias for field number 0
|
|
|
|
""")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_property(self):
|
|
|
|
self.assertEqual(self._get_summary_lines(Rect.area), """\
|
2024-02-20 11:14:34 -04:00
|
|
|
area
|
|
|
|
Area of the rect
|
|
|
|
""")
|
|
|
|
# inherits the docstring from Rect.area
|
|
|
|
self.assertEqual(self._get_summary_lines(Square.area), """\
|
|
|
|
area
|
2019-01-15 04:53:18 -04:00
|
|
|
Area of the rect
|
|
|
|
""")
|
|
|
|
self.assertIn("""
|
|
|
|
| area
|
|
|
|
| Area of the rect
|
|
|
|
""", pydoc.plain(pydoc.render_doc(Rect)))
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_custom_non_data_descriptor(self):
|
|
|
|
class Descr:
|
|
|
|
def __get__(self, obj, cls):
|
|
|
|
if obj is None:
|
|
|
|
return self
|
|
|
|
return 42
|
|
|
|
class X:
|
|
|
|
attr = Descr()
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), f"""\
|
|
|
|
<{__name__}.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>""")
|
2019-01-15 04:53:18 -04:00
|
|
|
|
|
|
|
X.attr.__doc__ = 'Custom descriptor'
|
2021-11-07 19:44:11 -04:00
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), f"""\
|
|
|
|
<{__name__}.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>
|
2020-04-18 11:13:21 -03:00
|
|
|
Custom descriptor
|
|
|
|
""")
|
2019-01-15 04:53:18 -04:00
|
|
|
|
|
|
|
X.attr.__name__ = 'foo'
|
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), """\
|
|
|
|
foo(...)
|
|
|
|
Custom descriptor
|
|
|
|
""")
|
|
|
|
|
|
|
|
@requires_docstrings
|
|
|
|
def test_custom_data_descriptor(self):
|
|
|
|
class Descr:
|
|
|
|
def __get__(self, obj, cls):
|
|
|
|
if obj is None:
|
|
|
|
return self
|
|
|
|
return 42
|
|
|
|
def __set__(self, obj, cls):
|
|
|
|
1/0
|
|
|
|
class X:
|
|
|
|
attr = Descr()
|
|
|
|
|
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), "")
|
|
|
|
|
|
|
|
X.attr.__doc__ = 'Custom descriptor'
|
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), """\
|
|
|
|
Custom descriptor
|
|
|
|
""")
|
|
|
|
|
|
|
|
X.attr.__name__ = 'foo'
|
|
|
|
self.assertEqual(self._get_summary_lines(X.attr), """\
|
|
|
|
foo
|
|
|
|
Custom descriptor
|
|
|
|
""")
|
|
|
|
|
2019-05-24 08:38:01 -03:00
|
|
|
def test_async_annotation(self):
|
|
|
|
async def coro_function(ign) -> int:
|
|
|
|
return 1
|
|
|
|
|
|
|
|
text = pydoc.plain(pydoc.plaintext.document(coro_function))
|
|
|
|
self.assertIn('async coro_function', text)
|
|
|
|
|
|
|
|
html = pydoc.HTMLDoc().document(coro_function)
|
|
|
|
self.assertIn(
|
|
|
|
'async <a name="-coro_function"><strong>coro_function',
|
|
|
|
html)
|
|
|
|
|
|
|
|
def test_async_generator_annotation(self):
|
|
|
|
async def an_async_generator():
|
|
|
|
yield 1
|
|
|
|
|
|
|
|
text = pydoc.plain(pydoc.plaintext.document(an_async_generator))
|
|
|
|
self.assertIn('async an_async_generator', text)
|
|
|
|
|
|
|
|
html = pydoc.HTMLDoc().document(an_async_generator)
|
|
|
|
self.assertIn(
|
|
|
|
'async <a name="-an_async_generator"><strong>an_async_generator',
|
|
|
|
html)
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2019-11-13 12:13:53 -04:00
|
|
|
def test_html_for_https_links(self):
|
|
|
|
def a_fn_with_https_link():
|
|
|
|
"""a link https://localhost/"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
html = pydoc.HTMLDoc().document(a_fn_with_https_link)
|
|
|
|
self.assertIn(
|
|
|
|
'<a href="https://localhost/">https://localhost/</a>',
|
|
|
|
html
|
|
|
|
)
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
|
2024-02-11 09:19:44 -04:00
|
|
|
class PydocFodderTest(unittest.TestCase):
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
2024-02-11 09:19:44 -04:00
|
|
|
|
|
|
|
def getsection(self, text, beginline, endline):
|
|
|
|
lines = text.splitlines()
|
|
|
|
beginindex, endindex = 0, None
|
|
|
|
if beginline is not None:
|
|
|
|
beginindex = lines.index(beginline)
|
|
|
|
if endline is not None:
|
|
|
|
endindex = lines.index(endline, beginindex)
|
|
|
|
return lines[beginindex:endindex]
|
|
|
|
|
|
|
|
def test_text_doc_routines_in_class(self, cls=pydocfodder.B):
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
result = doc.docclass(cls)
|
|
|
|
result = clean_text(result)
|
|
|
|
where = 'defined here' if cls is pydocfodder.B else 'inherited from B'
|
|
|
|
lines = self.getsection(result, f' | Methods {where}:', ' | ' + '-'*70)
|
|
|
|
self.assertIn(' | A_method_alias = A_method(self)', lines)
|
|
|
|
self.assertIn(' | B_method_alias = B_method(self)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn(' | A_staticmethod(x, y) from test.test_pydoc.pydocfodder.A', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn(' | A_staticmethod_alias = A_staticmethod(x, y)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn(' | global_func(x, y) from test.test_pydoc.pydocfodder', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn(' | global_func_alias = global_func(x, y)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn(' | global_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodder', lines)
|
2024-02-26 14:29:49 -04:00
|
|
|
self.assertIn(' | count(self, value, /) from builtins.list', lines)
|
|
|
|
self.assertIn(' | list_count = count(self, value, /)', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn(' | __repr__(self, /) from builtins.object', lines)
|
|
|
|
self.assertIn(' | object_repr = __repr__(self, /)', lines)
|
|
|
|
|
|
|
|
lines = self.getsection(result, f' | Static methods {where}:', ' | ' + '-'*70)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn(' | A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.A', lines)
|
|
|
|
note = '' if cls is pydocfodder.B else ' class method of test.test_pydoc.pydocfodder.B'
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn(' | B_classmethod_ref = B_classmethod(x)' + note, lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn(' | A_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instance', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn(' | get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
self.assertIn(' | dict_get = get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
|
|
|
|
lines = self.getsection(result, f' | Class methods {where}:', ' | ' + '-'*70)
|
|
|
|
self.assertIn(' | B_classmethod(x)', lines)
|
|
|
|
self.assertIn(' | B_classmethod_alias = B_classmethod(x)', lines)
|
|
|
|
|
|
|
|
def test_html_doc_routines_in_class(self, cls=pydocfodder.B):
|
|
|
|
doc = pydoc.HTMLDoc()
|
|
|
|
result = doc.docclass(cls)
|
|
|
|
result = html2text(result)
|
|
|
|
where = 'defined here' if cls is pydocfodder.B else 'inherited from B'
|
|
|
|
lines = self.getsection(result, f'Methods {where}:', '-'*70)
|
|
|
|
self.assertIn('A_method_alias = A_method(self)', lines)
|
|
|
|
self.assertIn('B_method_alias = B_method(self)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn('A_staticmethod(x, y) from test.test_pydoc.pydocfodder.A', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn('A_staticmethod_alias = A_staticmethod(x, y)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn('global_func(x, y) from test.test_pydoc.pydocfodder', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn('global_func_alias = global_func(x, y)', lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn('global_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodder', lines)
|
2024-02-26 14:29:49 -04:00
|
|
|
self.assertIn('count(self, value, /) from builtins.list', lines)
|
|
|
|
self.assertIn('list_count = count(self, value, /)', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn('__repr__(self, /) from builtins.object', lines)
|
|
|
|
self.assertIn('object_repr = __repr__(self, /)', lines)
|
|
|
|
|
|
|
|
lines = self.getsection(result, f'Static methods {where}:', '-'*70)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn('A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.A', lines)
|
|
|
|
note = '' if cls is pydocfodder.B else ' class method of test.test_pydoc.pydocfodder.B'
|
2024-02-11 09:19:44 -04:00
|
|
|
self.assertIn('B_classmethod_ref = B_classmethod(x)' + note, lines)
|
2024-02-13 06:40:40 -04:00
|
|
|
self.assertIn('A_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instance', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
|
|
|
|
lines = self.getsection(result, f'Class methods {where}:', '-'*70)
|
|
|
|
self.assertIn('B_classmethod(x)', lines)
|
|
|
|
self.assertIn('B_classmethod_alias = B_classmethod(x)', lines)
|
|
|
|
|
|
|
|
def test_text_doc_inherited_routines_in_class(self):
|
|
|
|
self.test_text_doc_routines_in_class(pydocfodder.D)
|
|
|
|
|
|
|
|
def test_html_doc_inherited_routines_in_class(self):
|
|
|
|
self.test_html_doc_routines_in_class(pydocfodder.D)
|
|
|
|
|
|
|
|
def test_text_doc_routines_in_module(self):
|
|
|
|
doc = pydoc.TextDoc()
|
|
|
|
result = doc.docmodule(pydocfodder)
|
|
|
|
result = clean_text(result)
|
|
|
|
lines = self.getsection(result, 'FUNCTIONS', 'FILE')
|
|
|
|
# function alias
|
|
|
|
self.assertIn(' global_func_alias = global_func(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod_alias = A_staticmethod(x, y)', lines)
|
|
|
|
# bound class methods
|
|
|
|
self.assertIn(' A_classmethod(x) class method of A', lines)
|
|
|
|
self.assertIn(' A_classmethod2 = A_classmethod(x) class method of A', lines)
|
|
|
|
self.assertIn(' A_classmethod3 = A_classmethod(x) class method of B', lines)
|
|
|
|
# bound methods
|
|
|
|
self.assertIn(' A_method() method of A instance', lines)
|
|
|
|
self.assertIn(' A_method2 = A_method() method of A instance', lines)
|
|
|
|
self.assertIn(' A_method3 = A_method() method of B instance', lines)
|
|
|
|
self.assertIn(' A_staticmethod_ref = A_staticmethod(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod_ref2 = A_staticmethod(y) method of B instance', lines)
|
|
|
|
self.assertIn(' get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
self.assertIn(' dict_get = get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
# unbound methods
|
|
|
|
self.assertIn(' B_method(self)', lines)
|
|
|
|
self.assertIn(' B_method2 = B_method(self)', lines)
|
2024-02-26 14:29:49 -04:00
|
|
|
self.assertIn(' count(self, value, /) unbound builtins.list method', lines)
|
|
|
|
self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines)
|
|
|
|
self.assertIn(' __repr__(self, /) unbound builtins.object method', lines)
|
|
|
|
self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
|
|
|
|
def test_html_doc_routines_in_module(self):
|
|
|
|
doc = pydoc.HTMLDoc()
|
|
|
|
result = doc.docmodule(pydocfodder)
|
|
|
|
result = html2text(result)
|
|
|
|
lines = self.getsection(result, ' Functions', None)
|
|
|
|
# function alias
|
|
|
|
self.assertIn(' global_func_alias = global_func(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod_alias = A_staticmethod(x, y)', lines)
|
|
|
|
# bound class methods
|
|
|
|
self.assertIn('A_classmethod(x) class method of A', lines)
|
|
|
|
self.assertIn(' A_classmethod2 = A_classmethod(x) class method of A', lines)
|
|
|
|
self.assertIn(' A_classmethod3 = A_classmethod(x) class method of B', lines)
|
|
|
|
# bound methods
|
|
|
|
self.assertIn(' A_method() method of A instance', lines)
|
|
|
|
self.assertIn(' A_method2 = A_method() method of A instance', lines)
|
|
|
|
self.assertIn(' A_method3 = A_method() method of B instance', lines)
|
|
|
|
self.assertIn(' A_staticmethod_ref = A_staticmethod(x, y)', lines)
|
|
|
|
self.assertIn(' A_staticmethod_ref2 = A_staticmethod(y) method of B instance', lines)
|
|
|
|
self.assertIn(' get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
self.assertIn(' dict_get = get(key, default=None, /) method of builtins.dict instance', lines)
|
|
|
|
# unbound methods
|
|
|
|
self.assertIn(' B_method(self)', lines)
|
|
|
|
self.assertIn(' B_method2 = B_method(self)', lines)
|
2024-02-26 14:29:49 -04:00
|
|
|
self.assertIn(' count(self, value, /) unbound builtins.list method', lines)
|
|
|
|
self.assertIn(' list_count = count(self, value, /) unbound builtins.list method', lines)
|
|
|
|
self.assertIn(' __repr__(self, /) unbound builtins.object method', lines)
|
|
|
|
self.assertIn(' object_repr = __repr__(self, /) unbound builtins.object method', lines)
|
2024-02-11 09:19:44 -04:00
|
|
|
|
|
|
|
|
2022-05-16 11:02:37 -03:00
|
|
|
@unittest.skipIf(
|
|
|
|
is_emscripten or is_wasi,
|
|
|
|
"Socket server not available on Emscripten/WASI."
|
|
|
|
)
|
2011-01-30 04:37:19 -04:00
|
|
|
class PydocServerTest(unittest.TestCase):
|
2010-12-03 05:29:11 -04:00
|
|
|
"""Tests for pydoc._start_server"""
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
2010-12-03 05:29:11 -04:00
|
|
|
|
|
|
|
def test_server(self):
|
2021-11-07 19:44:11 -04:00
|
|
|
# Minimal test that starts the server, checks that it works, then stops
|
|
|
|
# it and checks its cleanup.
|
2010-12-03 05:29:11 -04:00
|
|
|
def my_url_handler(url, content_type):
|
|
|
|
text = 'the URL sent was: (%s, %s)' % (url, content_type)
|
|
|
|
return text
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
serverthread = pydoc._start_server(
|
|
|
|
my_url_handler,
|
|
|
|
hostname='localhost',
|
|
|
|
port=0,
|
|
|
|
)
|
|
|
|
self.assertEqual(serverthread.error, None)
|
|
|
|
self.assertTrue(serverthread.serving)
|
|
|
|
self.addCleanup(
|
|
|
|
lambda: serverthread.stop() if serverthread.serving else None
|
|
|
|
)
|
|
|
|
self.assertIn('localhost', serverthread.url)
|
2010-12-03 05:29:11 -04:00
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
self.addCleanup(urlcleanup)
|
|
|
|
self.assertEqual(
|
|
|
|
b'the URL sent was: (/test, text/html)',
|
|
|
|
urlopen(urllib.parse.urljoin(serverthread.url, '/test')).read(),
|
|
|
|
)
|
|
|
|
self.assertEqual(
|
|
|
|
b'the URL sent was: (/test.css, text/css)',
|
|
|
|
urlopen(urllib.parse.urljoin(serverthread.url, '/test.css')).read(),
|
|
|
|
)
|
2010-12-03 05:29:11 -04:00
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
serverthread.stop()
|
|
|
|
self.assertFalse(serverthread.serving)
|
|
|
|
self.assertIsNone(serverthread.docserver)
|
|
|
|
self.assertIsNone(serverthread.url)
|
2010-12-03 05:29:11 -04:00
|
|
|
|
|
|
|
|
2013-05-19 10:44:54 -03:00
|
|
|
class PydocUrlHandlerTest(PydocBaseTest):
|
2010-12-03 05:29:11 -04:00
|
|
|
"""Tests for pydoc._url_handler"""
|
|
|
|
|
|
|
|
def test_content_type_err(self):
|
|
|
|
f = pydoc._url_handler
|
2011-01-30 04:37:19 -04:00
|
|
|
self.assertRaises(TypeError, f, 'A', '')
|
|
|
|
self.assertRaises(TypeError, f, 'B', 'foobar')
|
2010-12-03 05:29:11 -04:00
|
|
|
|
|
|
|
def test_url_requests(self):
|
|
|
|
# Test for the correct title in the html pages returned.
|
|
|
|
# This tests the different parts of the URL handler without
|
|
|
|
# getting too picky about the exact html.
|
|
|
|
requests = [
|
2011-01-30 04:37:19 -04:00
|
|
|
("", "Pydoc: Index of Modules"),
|
|
|
|
("get?key=", "Pydoc: Index of Modules"),
|
|
|
|
("index", "Pydoc: Index of Modules"),
|
|
|
|
("topics", "Pydoc: Topics"),
|
|
|
|
("keywords", "Pydoc: Keywords"),
|
|
|
|
("pydoc", "Pydoc: module pydoc"),
|
|
|
|
("get?key=pydoc", "Pydoc: module pydoc"),
|
|
|
|
("search?key=pydoc", "Pydoc: Search Results"),
|
|
|
|
("topic?key=def", "Pydoc: KEYWORD def"),
|
|
|
|
("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
|
|
|
|
("foobar", "Pydoc: Error - foobar"),
|
2010-12-03 05:29:11 -04:00
|
|
|
]
|
|
|
|
|
2024-06-18 06:19:32 -03:00
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
|
|
|
try:
|
|
|
|
with self.restrict_walk_packages():
|
|
|
|
for url, title in requests:
|
|
|
|
self.call_url_handler(url, title)
|
|
|
|
finally:
|
|
|
|
# Some requests reload the module and change sys.modules.
|
|
|
|
sys.modules['pydoc'] = pydoc
|
2013-05-19 10:44:54 -03:00
|
|
|
|
2010-12-03 05:29:11 -04:00
|
|
|
|
2011-04-28 01:42:55 -03:00
|
|
|
class TestHelper(unittest.TestCase):
|
|
|
|
def test_keywords(self):
|
|
|
|
self.assertEqual(sorted(pydoc.Helper.keywords),
|
|
|
|
sorted(keyword.kwlist))
|
|
|
|
|
2021-11-07 19:44:11 -04:00
|
|
|
|
2013-10-21 02:37:39 -03:00
|
|
|
class PydocWithMetaClasses(unittest.TestCase):
|
2024-06-18 06:19:32 -03:00
|
|
|
def tearDown(self):
|
|
|
|
self.assertIs(sys.modules['pydoc'], pydoc)
|
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2013-10-21 02:37:39 -03:00
|
|
|
def test_DynamicClassAttribute(self):
|
|
|
|
class Meta(type):
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name == 'ham':
|
|
|
|
return 'spam'
|
|
|
|
return super().__getattr__(name)
|
|
|
|
class DA(metaclass=Meta):
|
|
|
|
@types.DynamicClassAttribute
|
|
|
|
def ham(self):
|
|
|
|
return 'eggs'
|
2013-10-22 11:30:24 -03:00
|
|
|
expected_text_data_docstrings = tuple('\n | ' + s if s else ''
|
|
|
|
for s in expected_data_docstrings)
|
2013-10-21 02:37:39 -03:00
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper(DA)
|
2013-10-22 11:30:24 -03:00
|
|
|
expected_text = expected_dynamicattribute_pattern % (
|
|
|
|
(__name__,) + expected_text_data_docstrings[:2])
|
2013-10-21 02:37:39 -03:00
|
|
|
result = output.getvalue().strip()
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text, result)
|
2013-10-21 02:37:39 -03:00
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2013-10-21 02:37:39 -03:00
|
|
|
def test_virtualClassAttributeWithOneMeta(self):
|
|
|
|
class Meta(type):
|
|
|
|
def __dir__(cls):
|
|
|
|
return ['__class__', '__module__', '__name__', 'LIFE']
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name =='LIFE':
|
|
|
|
return 42
|
|
|
|
return super().__getattr(name)
|
|
|
|
class Class(metaclass=Meta):
|
|
|
|
pass
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper(Class)
|
|
|
|
expected_text = expected_virtualattribute_pattern1 % __name__
|
|
|
|
result = output.getvalue().strip()
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text, result)
|
2013-10-21 02:37:39 -03:00
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2013-10-21 02:37:39 -03:00
|
|
|
def test_virtualClassAttributeWithTwoMeta(self):
|
|
|
|
class Meta1(type):
|
|
|
|
def __dir__(cls):
|
|
|
|
return ['__class__', '__module__', '__name__', 'one']
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name =='one':
|
|
|
|
return 1
|
|
|
|
return super().__getattr__(name)
|
|
|
|
class Meta2(type):
|
|
|
|
def __dir__(cls):
|
|
|
|
return ['__class__', '__module__', '__name__', 'two']
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name =='two':
|
|
|
|
return 2
|
|
|
|
return super().__getattr__(name)
|
|
|
|
class Meta3(Meta1, Meta2):
|
|
|
|
def __dir__(cls):
|
|
|
|
return list(sorted(set(
|
|
|
|
['__class__', '__module__', '__name__', 'three'] +
|
|
|
|
Meta1.__dir__(cls) + Meta2.__dir__(cls))))
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name =='three':
|
|
|
|
return 3
|
|
|
|
return super().__getattr__(name)
|
|
|
|
class Class1(metaclass=Meta1):
|
|
|
|
pass
|
|
|
|
class Class2(Class1, metaclass=Meta3):
|
|
|
|
pass
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper(Class1)
|
|
|
|
expected_text1 = expected_virtualattribute_pattern2 % __name__
|
|
|
|
result1 = output.getvalue().strip()
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text1, result1)
|
2013-10-21 02:37:39 -03:00
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper(Class2)
|
|
|
|
expected_text2 = expected_virtualattribute_pattern3 % __name__
|
|
|
|
result2 = output.getvalue().strip()
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text2, result2)
|
2013-10-21 02:37:39 -03:00
|
|
|
|
2013-10-22 11:30:24 -03:00
|
|
|
@unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
|
|
|
|
'trace function introduces __locals__ unexpectedly')
|
2021-11-07 19:44:11 -04:00
|
|
|
@requires_docstrings
|
2013-10-21 02:37:39 -03:00
|
|
|
def test_buggy_dir(self):
|
|
|
|
class M(type):
|
|
|
|
def __dir__(cls):
|
|
|
|
return ['__class__', '__name__', 'missing', 'here']
|
|
|
|
class C(metaclass=M):
|
|
|
|
here = 'present!'
|
|
|
|
output = StringIO()
|
|
|
|
helper = pydoc.Helper(output=output)
|
|
|
|
helper(C)
|
|
|
|
expected_text = expected_missingattribute_pattern % __name__
|
|
|
|
result = output.getvalue().strip()
|
2014-06-21 16:08:22 -03:00
|
|
|
self.assertEqual(expected_text, result)
|
2013-10-21 02:37:39 -03:00
|
|
|
|
2015-04-21 15:09:48 -03:00
|
|
|
def test_resolve_false(self):
|
|
|
|
# Issue #23008: pydoc enum.{,Int}Enum failed
|
|
|
|
# because bool(enum.Enum) is False.
|
|
|
|
with captured_stdout() as help_io:
|
|
|
|
pydoc.help('enum.Enum')
|
|
|
|
helptext = help_io.getvalue()
|
|
|
|
self.assertIn('class Enum', helptext)
|
|
|
|
|
2014-01-04 23:38:11 -04:00
|
|
|
|
2018-04-15 08:52:57 -03:00
|
|
|
class TestInternalUtilities(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
tmpdir = tempfile.TemporaryDirectory()
|
|
|
|
self.argv0dir = tmpdir.name
|
|
|
|
self.argv0 = os.path.join(tmpdir.name, "nonexistent")
|
|
|
|
self.addCleanup(tmpdir.cleanup)
|
|
|
|
self.abs_curdir = abs_curdir = os.getcwd()
|
|
|
|
self.curdir_spellings = ["", os.curdir, abs_curdir]
|
|
|
|
|
|
|
|
def _get_revised_path(self, given_path, argv0=None):
|
|
|
|
# Checking that pydoc.cli() actually calls pydoc._get_revised_path()
|
|
|
|
# is handled via code review (at least for now).
|
|
|
|
if argv0 is None:
|
|
|
|
argv0 = self.argv0
|
|
|
|
return pydoc._get_revised_path(given_path, argv0)
|
|
|
|
|
|
|
|
def _get_starting_path(self):
|
2018-04-15 10:32:05 -03:00
|
|
|
# Get a copy of sys.path without the current directory.
|
2018-04-15 08:52:57 -03:00
|
|
|
clean_path = sys.path.copy()
|
|
|
|
for spelling in self.curdir_spellings:
|
|
|
|
for __ in range(clean_path.count(spelling)):
|
|
|
|
clean_path.remove(spelling)
|
|
|
|
return clean_path
|
|
|
|
|
|
|
|
def test_sys_path_adjustment_adds_missing_curdir(self):
|
|
|
|
clean_path = self._get_starting_path()
|
|
|
|
expected_path = [self.abs_curdir] + clean_path
|
|
|
|
self.assertEqual(self._get_revised_path(clean_path), expected_path)
|
|
|
|
|
|
|
|
def test_sys_path_adjustment_removes_argv0_dir(self):
|
|
|
|
clean_path = self._get_starting_path()
|
|
|
|
expected_path = [self.abs_curdir] + clean_path
|
|
|
|
leading_argv0dir = [self.argv0dir] + clean_path
|
|
|
|
self.assertEqual(self._get_revised_path(leading_argv0dir), expected_path)
|
|
|
|
trailing_argv0dir = clean_path + [self.argv0dir]
|
|
|
|
self.assertEqual(self._get_revised_path(trailing_argv0dir), expected_path)
|
|
|
|
|
|
|
|
def test_sys_path_adjustment_protects_pydoc_dir(self):
|
|
|
|
def _get_revised_path(given_path):
|
|
|
|
return self._get_revised_path(given_path, argv0=pydoc.__file__)
|
|
|
|
clean_path = self._get_starting_path()
|
|
|
|
leading_argv0dir = [self.argv0dir] + clean_path
|
|
|
|
expected_path = [self.abs_curdir] + leading_argv0dir
|
|
|
|
self.assertEqual(_get_revised_path(leading_argv0dir), expected_path)
|
|
|
|
trailing_argv0dir = clean_path + [self.argv0dir]
|
|
|
|
expected_path = [self.abs_curdir] + trailing_argv0dir
|
|
|
|
self.assertEqual(_get_revised_path(trailing_argv0dir), expected_path)
|
|
|
|
|
|
|
|
def test_sys_path_adjustment_when_curdir_already_included(self):
|
|
|
|
clean_path = self._get_starting_path()
|
|
|
|
for spelling in self.curdir_spellings:
|
|
|
|
with self.subTest(curdir_spelling=spelling):
|
|
|
|
# If curdir is already present, no alterations are made at all
|
|
|
|
leading_curdir = [spelling] + clean_path
|
|
|
|
self.assertIsNone(self._get_revised_path(leading_curdir))
|
|
|
|
trailing_curdir = clean_path + [spelling]
|
|
|
|
self.assertIsNone(self._get_revised_path(trailing_curdir))
|
|
|
|
leading_argv0dir = [self.argv0dir] + leading_curdir
|
|
|
|
self.assertIsNone(self._get_revised_path(leading_argv0dir))
|
|
|
|
trailing_argv0dir = trailing_curdir + [self.argv0dir]
|
|
|
|
self.assertIsNone(self._get_revised_path(trailing_argv0dir))
|
|
|
|
|
|
|
|
|
2021-09-19 09:27:33 -03:00
|
|
|
def setUpModule():
|
|
|
|
thread_info = threading_helper.threading_setup()
|
|
|
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
|
|
|
unittest.addModuleCleanup(reap_children)
|
|
|
|
|
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63412 | georg.brandl | 2008-05-17 19:57:01 +0200 (Sat, 17 May 2008) | 2 lines
#961805: fix Edit.text_modified().
........
r63445 | georg.brandl | 2008-05-18 10:52:59 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #180 by Michael Schneider: add examples to the socketserver documentation.
........
r63446 | georg.brandl | 2008-05-18 11:12:20 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
........
r63447 | georg.brandl | 2008-05-18 12:39:26 +0200 (Sun, 18 May 2008) | 3 lines
Take namedtuple item names only from ascii_letters (this blew up on OSX),
and make sure there are no duplicate names.
........
r63449 | georg.brandl | 2008-05-18 13:46:51 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #217: add support for compiling Python with coverage checking enabled.
........
r63450 | georg.brandl | 2008-05-18 13:52:36 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #257: test distutils' build_ext command, written by Josip Dzolonga.
........
r63452 | georg.brandl | 2008-05-18 15:34:06 +0200 (Sun, 18 May 2008) | 2 lines
Add GHOP students.
........
r63454 | georg.brandl | 2008-05-18 18:32:48 +0200 (Sun, 18 May 2008) | 2 lines
GHOP #121: improve test_pydoc, by Benjamin Peterson.
........
r63459 | benjamin.peterson | 2008-05-18 22:48:07 +0200 (Sun, 18 May 2008) | 2 lines
bring test_pydoc up to my high standards (now that I have them)
........
r63463 | georg.brandl | 2008-05-18 23:10:19 +0200 (Sun, 18 May 2008) | 2 lines
Fix test_pyclbr after another platform-dependent function was added to urllib.
........
r63465 | benjamin.peterson | 2008-05-19 01:07:07 +0200 (Mon, 19 May 2008) | 2 lines
change some imports in tests so they will not be skipped in 3.0
........
r63470 | georg.brandl | 2008-05-19 18:47:25 +0200 (Mon, 19 May 2008) | 2 lines
test_httpservers has unpredictable refcount behavior.
........
r63483 | georg.brandl | 2008-05-20 08:15:36 +0200 (Tue, 20 May 2008) | 2 lines
Activate two more test cases in test_httpservers.
........
r63484 | georg.brandl | 2008-05-20 08:47:31 +0200 (Tue, 20 May 2008) | 2 lines
Argh, this is the *actual* test that works under Windows.
........
r63496 | georg.brandl | 2008-05-20 10:07:36 +0200 (Tue, 20 May 2008) | 2 lines
Improve diffing logic and output for test_pydoc.
........
r63497 | georg.brandl | 2008-05-20 10:10:03 +0200 (Tue, 20 May 2008) | 2 lines
Use inspect.getabsfile() to get the documented module's filename.
........
r63499 | georg.brandl | 2008-05-20 10:25:48 +0200 (Tue, 20 May 2008) | 3 lines
Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
........
r63500 | georg.brandl | 2008-05-20 10:40:43 +0200 (Tue, 20 May 2008) | 2 lines
#2592: delegate nb_index and the floor/truediv slots in weakref.proxy.
........
r63501 | georg.brandl | 2008-05-20 10:48:34 +0200 (Tue, 20 May 2008) | 2 lines
#615772: raise a more explicit error from Tkinter.Misc.__contains__.
........
r63530 | benjamin.peterson | 2008-05-22 02:57:02 +0200 (Thu, 22 May 2008) | 2 lines
use more specific asserts in test_opcode
........
r63531 | benjamin.peterson | 2008-05-22 03:02:23 +0200 (Thu, 22 May 2008) | 2 lines
remove redundant invocation of json doctests
........
r63540 | benjamin.peterson | 2008-05-23 01:09:26 +0200 (Fri, 23 May 2008) | 3 lines
fix test_pydoc so it works on make installed Python installations
Also let it pass when invoked directly
........
r63614 | georg.brandl | 2008-05-25 10:07:37 +0200 (Sun, 25 May 2008) | 2 lines
#2959: allow multiple close() calls for GzipFile.
........
2008-05-25 15:19:30 -03:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-09-19 09:27:33 -03:00
|
|
|
unittest.main()
|