summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove spaces in empty lines (GH-30121)AN Long2021-12-151-1/+1
|
* bpo-27062: add `__all__` to inspect module (GH-30003)Kumar Aditya2021-12-101-0/+3
|
* bpo-30533:Add function inspect.getmembers_static that does not call ↵Weipeng Hong2021-11-301-0/+17
| | | | | | | | | | | | | | | | | | | | | properties or dynamic properties. (#20911) * Add function inspect.getmembers_static that does not call properties or dynamic properties. * update _getmembers args * Update Misc/NEWS.d/next/Library/2020-06-16-18-00-56.bpo-30533.StL57t.rst Co-authored-by: Itamar Ostricher <itamarost@gmail.com> * Update Lib/inspect.py Co-authored-by: Itamar Ostricher <itamarost@gmail.com> * Removes the copy pasted doc string Co-authored-by: Itamar Ostricher <itamarost@gmail.com> Co-authored-by: Dino Viehland <dinoviehland@gmail.com>
* bpo-45406: make inspect.getmodule() return None when getabsfile() raises ↵Irit Katriel2021-11-021-0/+9
| | | | FileNotFoundError (GH-28824)
* bpo-45438: format of inspect.Signature with generic builtins (#29212)Martin Rueckl2021-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>
* bpo-45320: Remove long-deprecated inspect methods (GH-28618)Hugo van Kemenade2021-10-201-94/+14
|
* bpo-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-191-16/+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.
* bpo-44808: fixes test for interactive inspect getsource of a class (GH-27571)andrei kulakov2021-08-031-12/+8
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44808: Fix test_inspect in refleak mode (GH-27544)Pablo Galindo Salgado2021-08-021-1/+2
|
* bpo-44648: Fix error type in inspect.getsource() in interactive session ↵andrei kulakov2021-07-301-1/+16
| | | | (GH-27171)
* bpo-40897:Give priority to using the current class constructor in ↵Weipeng Hong2021-07-161-0/+41
| | | | | `inspect.signature` (#27177) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-20684: Remove unused inspect._signature_get_bound_param (GH-21100)Anthony Sottile2021-05-221-7/+0
|
* bpo-43817: Add inspect.get_annotations(). (#25522)larryhastings2021-04-301-5/+238
| | | | | Add inspect.get_annotations, which safely computes the annotations defined on an object. It works around the quirks of accessing the annotations from various types of objects, and makes very few assumptions about the object passed in. inspect.get_annotations can also correctly un-stringize stringized annotations. inspect.signature, inspect.from_callable, and inspect.from_function now call inspect.get_annotations to retrieve annotations. This means inspect.signature and inspect.from_callable can now un-stringize stringized annotations, too.
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-24/+28
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189)Inada Naoki2021-04-061-6/+6
| | | | | | | | | | | | * Fix _sitebuiltins * Fix test_inspect * Fix test_interpreters * Fix test_io * Fix test_iter * Fix test_json * Fix test_linecache * Fix test_lltrace * Fix test_logging * Fix logging
* bpo-31861: Add aiter and anext to builtins (#23847)Joshua Bronson2021-03-231-0/+3
| | | | | | Co-authored-by: jab <jab@users.noreply.github.com> Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk> Co-authored-by: Justin Wang <justin39@gmail.com>
* bpo-41960: Add globalns and localns parameters to inspect.signature and ↵Batuhan Taskaya2020-12-231-0/+20
| | | | Signature.from_callable (GH-22583)
* bpo-17735: inspect.findsource now raises OSError when co_lineno is out of ↵Irit Katriel2020-12-041-0/+11
| | | | | range (GH-23633) This can happen when a file was edited after it was imported.
* bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)Irit Katriel2020-12-041-4/+19
|
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-24/+20
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-40275: Use new test.support helper submodules in tests (GH-21727)Hai Shi2020-08-041-1/+3
|
* 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