summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' ↵Miss Islington (bot)2022-01-211-0/+11
| | | | | | | (GH-30285) (cherry picked from commit 881a763cfe07ef4a5806ec78f13a9bc99e8909dc) Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
* [3.9] bpo-46411: Remove unnecessary calls to sys.exc_info() in tests ↵Miss Islington (bot)2022-01-181-2/+2
| | | | | | | | | | (GH-30638) (GH-30658) (cherry picked from commit a287b31bcb065e4122400cb59167340d25480e6d) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Automerge-Triggered-By: GH:iritkatriel
* bpo-45406: make inspect.getmodule() return None when getabsfile() raises ↵Miss Islington (bot)2021-11-021-0/+9
| | | | | | | FileNotFoundError (GH-28824) (cherry picked from commit a459a81530de700b3d3faeb827b22ed1c9985812) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* bpo-45438: format of inspect.Signature with generic builtins (GH-29212)Miss Islington (bot)2021-10-271-0/+11
| | | | | | | | | | Use types.GenericAlias in inspect.formatannotation to correctly add type arguments of builtin types to the string representation of Signatures. Co-authored-by: Martin Rückl <martin.rueckl@codecentric.de> (cherry picked from commit d02ffd1b5c0fd8dec6dd2f7e3f2b0cfae48b7899) Co-authored-by: Martin Rueckl <enigma@nbubu.de>
* [3.9] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28456)Serhiy Storchaka2021-09-201-15/+2
| | | | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.. (cherry picked from commit 40348acc180580371d25f75f46b27048e35f2435)
* bpo-40897:Give priority to using the current class constructor in ↵Miss Islington (bot)2021-07-171-0/+41
| | | | | | | | `inspect.signature` (GH-27177) (GH-27209) Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 6aab5f9bf303a8e4cd8377fabcdcb499e0541f9a) Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
* bpo-17735: inspect.findsource now raises OSError when co_lineno is out of ↵Miss Islington (bot)2020-12-041-0/+11
| | | | | | | | range (GH-23633) This can happen when a file was edited after it was imported. (cherry picked from commit 2e0760bb2edb595050aff82f236cd32b44d3dfb3) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)Miss Islington (bot)2020-12-041-4/+19
| | | | | (cherry picked from commit 6e1eec71f59c344fb23c7977061dc2c97b77d51b) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-40257: Revert changes to inspect.getdoc() (GH-20073)Serhiy Storchaka2020-05-181-12/+3
|
* bpo-35113: Fix inspect.getsource to return correct source for inner classes ↵Karthikeyan Singaravelan2020-04-181-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#10307) * Use ast module to find class definition * Add NEWS entry * Fix class with multiple children and move decorator code to the method * Fix PR comments 1. Use node.decorator_list to select decorators 2. Remove unwanted variables in ClassVisitor 3. Simplify stack management as per review * Add test for nested functions and async calls * Fix pydoc test since comments are returned now correctly * Set event loop policy as None to fix environment related change * Refactor visit_AsyncFunctionDef and tests * Refactor to use local variables and fix tests * Add patch attribution * Use self.addCleanup for asyncio * Rename ClassVisitor to ClassFinder and fix asyncio cleanup * Return first class inside conditional in case of multiple definitions. Remove decorator for class source. * Add docstring to make the test correct * Modify NEWS entry regarding decorators * Return decorators too for bpo-15856 * Move ast and the class source code to top. Use proper Exception.
* bpo-40257: Output object's own docstring in pydoc (GH-19479)Serhiy Storchaka2020-04-151-3/+12
|
* bpo-39957: Change Signature.parameters to OrderedDict (GH-18988)Jens Reidel2020-03-181-1/+6
|
* bpo-36350: inspect: Replace OrderedDict with dict. (GH-12412)Rémi Lapeyre2020-01-281-0/+5
|
* bpo-38478: Correctly handle keyword argument with same name as ↵Pablo Galindo2019-10-151-0/+10
| | | | positional-only parameter (GH-16800)
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-141-2/+2
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* bpo-34706: Preserve subclassing in inspect.Signature.from_callable (GH-16108)Gregory P. Smith2019-09-131-2/+9
| | | | | | | | https://bugs.python.org/issue34706 Specifically in the case of a class that does not override its constructor signature inherited from object. These are Buck Evan @bukzor's changes cherrypicked from GH-9344.
* bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167)Serhiy Storchaka2019-08-081-11/+7
|
* bpo-37173: Show passed class in inspect.getfile error (GH-13861)Philipp A2019-06-081-0/+18
| | | | | | | | | | | | | Currently, inspect.getfile(str) will report nonsense: ```pytb >>> inspect.getfile(str) TypeError: <module 'builtins' (built-in)> is a built-in class ``` This fixes that https://bugs.python.org/issue37173
* bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)Xtreak2019-05-301-6/+9
| | | | | | Fix DeprecationWarning introduced in aee19f54f6fe45f6b3c906987941e5a8af4468e9 https://bugs.python.org/issue37099
* bpo-36785: PEP 574 implementation (GH-7076)Antoine Pitrou2019-05-261-6/+5
|
* bpo-36751: Undeprecate getfullargspec (GH-13245)Pablo Galindo2019-05-161-34/+20
|
* bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)Serhiy Storchaka2019-05-061-0/+11
|
* bpo-36751: Deprecate getfullargspec and report positional-only args as ↵Pablo Galindo2019-04-301-34/+42
| | | | | | | | regular args (GH-13016) * bpo-36751: Deprecate getfullargspec and report positional-only args as regular args * Use inspect.signature in testhelpers
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-33261: guard access to __code__ attribute in inspect (GH-6448)Jeroen Demeyer2019-04-021-0/+1
|
* bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)Raymond Hettinger2019-03-251-0/+9
|
* bpo-34890: Make iscoroutinefunction, isgeneratorfunction and ↵Pablo Galindo2018-10-261-1/+26
| | | | | | | | | | | isasyncgenfunction work with functools.partial (GH-9903) inspect.isfunction() processes both inspect.isfunction(func) and inspect.isfunction(partial(func, arg)) correctly but some other functions in the inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction) lack this functionality. This commits adds a new check in the mentioned functions in the inspect module so they can work correctly with arbitrarily nested partial functions.
* bpo-34871: Fix two typos in test_inspect.py (GH-9698)Chih-Hsuan Yen2018-10-041-2/+2
| | | | | | `arg` is misspelled as `agr`. I noticed this when playing with https://bugs.python.org/issue34871 https://bugs.python.org/issue34871
* bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks ↵Vladimir Matveev2018-08-241-2/+12
| | | | (GH-8864)
* bpo-33582: Emit deprecation warning for `formatargspec` (GH-6994)Matthias Bussonnier2018-06-111-4/+6
|
* bpo-33197: Update a error message of invalid inspect.Parameters. (GH-6636)Dong-hee Na2018-05-291-3/+22
|
* bpo-26103: Fix inspect.isdatadescriptor() and a data descriptor definition. ↵Aaron Hall, MBA2018-05-201-1/+56
| | | | | | (GH-1959) Look for '__set__' or '__delete__'.
* bpo-33009: Fix inspect.signature() for single-parameter partialmethods. ↵Yury Selivanov2018-03-061-0/+10
| | | | (GH-6004)
* bpo-32697: Definition order of kwonly params is now guaranteed preserved. ↵larryhastings2018-01-281-0/+47
| | | | | | (#5391) Definition order of kwonly params is now guaranteed preserved.
* bpo-31778: Make ast.literal_eval() more strict. (#4035)Serhiy Storchaka2018-01-041-1/+1
| | | | Addition and subtraction of arbitrary numbers no longer allowed.
* bpo-32265: Classify class and static methods of builtin types. (#4776)Serhiy Storchaka2017-12-151-1/+14
| | | | Add types.ClassMethodDescriptorType for unbound class methods.
* bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-1/+1
| | | | | | | | * Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
* bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)Dong-hee Na2017-11-151-2/+2
|
* bpo-30639: Lazily compute repr for error (#2132)Thomas Kluyver2017-10-241-0/+8
|
* PEP 553 built-in breakpoint() function (bpo-31353) (#3355)Barry Warsaw2017-10-051-1/+2
| | | Implement PEP 553, built-in breakpoint() with support from sys.breakpointhook(), along with documentation and tests. Closes bpo-31353
* bpo-31462: Remove trailing whitespaces. (#3564)Serhiy Storchaka2017-09-141-1/+1
|
* bpo-25532: Protect against infinite loops in inspect.unwrap() (#1717)Thomas Kluyver2017-05-231-0/+18
| | | | | | | | | Some objects (like test mocks) auto-generate new objects on attribute access, which can lead to an infinite loop in inspect.unwrap(). Ensuring references are retained to otherwise temporary objects and capping the size of the memo dict turns this case into a conventional exception instead.
* bpo-30149: Fix partialmethod without explicit self parameter (#1308)Dong-hee Na2017-05-171-0/+35
|
* bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678)Nate2017-04-241-0/+24
| | | | | | | At the time when an abstract base class' __init_subclass__ runs, ABCMeta.__new__ has not yet finished running, so in the presence of __init_subclass__, inspect.isabstract() can no longer depend only on TPFLAGS_IS_ABSTRACT.
* bpo-16355: Clarify when inspect.getcomments() returns None (#428)Marco Buttu2017-03-171-0/+5
| | | Initial patch by Vajrasky Kok.
* Issue #15812: Merge from 3.6Berker Peksag2017-01-021-0/+5
|\
| * Issue #15812: Merge from 3.5Berker Peksag2017-01-021-0/+5
| |\
| | * Issue #15812: inspect.getframeinfo() now correctly shows the first line of a ↵Berker Peksag2017-01-021-0/+5
| | | | | | | | | | | | | | | | | | context Patch by Sam Breese.
* | | Remove unused imports.Serhiy Storchaka2016-12-161-3/+0
|/ /
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-1/+11
| |