summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* Revert part of 13f56cd8dec1 (issue #1785) to avoid breaking getmembers() ↵Antoine Pitrou2012-01-181-44/+18
| | | | | | | with unbound methods. Python 3 isn't affected (unbound methods don't exist). Thanks to Vincent Pelletier for noticing.
* Issue #1785: Fix inspect and pydoc with misbehaving descriptors.Antoine Pitrou2011-12-211-0/+96
| | | | Also fixes issue #13581: `help(type)` wouldn't display anything.
* allow "fake" filenames in findsource (closes #9284)Benjamin Peterson2011-06-111-0/+17
| | | | | | This allows findsource() to work in doctests. A patch from Dirkjan Ochtman.
* Correct handling of functions with only kwarg args in getcallargs (closes ↵Benjamin Peterson2011-03-281-0/+14
| | | | | | #11256) A patch from Daniel Urban.
* Merged revisions 86596 via svnmerge fromEzio Melotti2010-11-211-2/+2
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
* #8720: fix inspect regression by teaching getsourcefile about linecache.R. David Murray2010-06-171-0/+15
| | | | | | | | | The fix for issue 4050 caused a regression: before that fix, source lines in the linecache would eventually be found by inspect. After the fix inspect reports an error earlier, and the source isn't found. The fix for the fix is to have getsourcefile look in the linecache for the file and return the psuedo-filename if the source is there, just as it already returns it if there is a PEP 302 loader.
* Refactor a couple inspect module tests to remove duplicate codeJean-Paul Calderone2010-04-101-62/+26
| | | | | | | | | The test_classify_oldstyle and test_classify_newstyle methods of test.test_inspect.TestClassesAndFunctions were previously almost identical (aside from irrelevant whitespace and one semantic difference). They now share a single helper. Fixes issue #8363.
* Silence a py3k warning.Ezio Melotti2010-03-311-3/+6
|
* add inspect.getcallargs, which binds function arguments like a normal call #3135Benjamin Peterson2010-03-301-3/+193
| | | | Patch by George Sakkis
* #7092 - Silence more py3k deprecation warnings, using ↵Florent Xicluna2010-03-211-9/+15
| | | | test_support.check_py3k_warnings() helper.
* Issue 6292: for the moment at least, the test suite passes if runR. David Murray2010-02-231-0/+2
| | | | | | with -OO. Tests requiring docstrings are skipped. Patch by Brian Curtin, thanks to Matias Torchinsky for helping review and improve the patch.
* Remove unused imports in test modules.Georg Brandl2010-02-071-1/+1
|
* Fix test_inspect.py data to match recent change to inspect_fodder.py (r77942).Mark Dickinson2010-02-031-1/+1
|
* use assert[Not]In where appropriateEzio Melotti2010-01-231-50/+50
|
* Reverting the Revision: 77368. I committed Flox's big patch for tests bySenthil Kumaran2010-01-081-12/+9
| | | | mistake. ( It may come in for sure tough)
* Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. ↵Senthil Kumaran2010-01-081-9/+12
| | | | Patch by flox
* make inspect.isabstract() always return a boolean; add a test for it, too #7069Benjamin Peterson2009-10-151-0/+23
|
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-57/+57
|
* explicitly close filesPhilip Jenvey2009-05-281-1/+2
|
* Fix test failure on Windows, and add skip check if even unicodedataR. David Murray2009-05-141-3/+7
| | | | turns out not to be an external module on some other platform.
* Issue #4050: inspect.findsource/getsource now raise an IOError if the 'source'R. David Murray2009-05-131-0/+7
| | | | file is a binary. Patch by Brodie Rao, test by Daniel Diniz.
* fix inspect.isclass() on instances with a custom __getattr__ #1225107Benjamin Peterson2009-01-171-1/+12
|
* #1162154: inspect.getmembers() now skips attributes that raise AttributeError,Amaury Forgeot d'Arc2009-01-131-0/+11
| | | | e.g. a __slots__ attribute which has not been set.
* Fix several issues relating to access to source code inside zipfiles. ↵Nick Coghlan2008-12-141-0/+3
| | | | Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details.
* Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()Georg Brandl2008-06-071-0/+4
| | | | to ease standalone use of the algorithm.
* 15 -> 16, the 2ndGeorg Brandl2008-03-031-1/+1
|
* 15 -> 16Christian Heimes2008-03-031-2/+2
|
* Issue #1916. Added isgenerator() and isgeneratorfunction() toFacundo Batista2008-02-181-8/+20
| | | | | inspect.py. Thanks Javi Mansilla for patch review and corrections.
* Replaced import of the 'new' module with 'types' module and added a ↵Christian Heimes2007-11-271-2/+2
| | | | deprecation warning to the 'new' module.
* Fix the speed regression in inspect.py by adding another cache to speed up ↵Nick Coghlan2006-09-071-0/+11
| | | | getmodule(). Patch #1553314
* Make tabnanny recognize IndentationErrors raised by tokenize.Georg Brandl2006-08-141-0/+3
| | | | | Add a test to test_inspect to make sure indented source is recognized correctly. (fixes #1224621)
* Ensure the actual number matches the expected countNeal Norwitz2006-07-281-3/+4
|
* Patch #1520294: Support for getset and member descriptors in types.py,Barry Warsaw2006-07-271-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | inspect.py, and pydoc.py. Specifically, this allows for querying the type of an object against these built-in C types and more importantly, for getting their docstrings printed in the interactive interpreter's help() function. This patch includes a new built-in module called _types which provides definitions of getset and member descriptors for use by the types.py module. These types are exposed as types.GetSetDescriptorType and types.MemberDescriptorType. Query functions are provided as inspect.isgetsetdescriptor() and inspect.ismemberdescriptor(). The implementations of these are robust enough to work with Python implementations other than CPython, which may not have these fundamental types. The patch also includes documentation and test suite updates. I commit these changes now under these guiding principles: 1. Silence is assent. The release manager has not said "no", and of the few people that cared enough to respond to the thread, the worst vote was "0". 2. It's easier to ask for forgiveness than permission. 3. It's so dang easy to revert stuff in svn, that you could view this as a forcing function. :) Windows build patches will follow.
* Fix SF#1516184 (again) and add a test to prevent regression.Phillip J. Eby2006-07-201-0/+1
| | | | (There was a problem with empty filenames still causing recursion)
* Whitespace normalization.Tim Peters2006-07-101-1/+1
|
* Fix SF#1516184 and add a test to prevent regression.Phillip J. Eby2006-07-101-0/+10
|
* Make use of new str.startswith/endswith semantics.Georg Brandl2006-06-091-1/+1
| | | | Occurences in email and compiler were ignored due to backwards compat requirements.
* Fix SF bug #1458903 with AST compiler.Neal Norwitz2006-03-271-2/+4
| | | | | | | | | | | | def foo((x)): was getting recognized as requiring tuple unpacking which is not correct. Add tests for this case and the proper way to unpack a tuple of one: def foo((x,)): test_inpsect was incorrect before. I'm not sure why it was passing, but that has been corrected with a test for both functions above. This means the test (and therefore inspect.getargspec()) are broken in 2.4.
* some more fixes and tests for inspect.getsource(), triggered by crashesArmin Rigo2005-09-251-0/+12
| | | | from the PyPy project as well as the SF bug #1295909.
* Patch #1159931/bug #1143895: inspect.getsource failed when functions,Johannes Gijsbers2005-03-121-0/+10
| | | | | | etc., had comments after the colon, and some other cases. This patch take a simpler approach that doesn't rely on looking for a ':'. Thanks Simon Percivall!
* Whitespace normalization.Tim Peters2005-01-071-22/+21
|
* Patch #1011890: fix inspect.getsource breaking with line-continuation &Johannes Gijsbers2004-12-121-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | more. Thanks to Simon Percivall! The patch makes changes to inspect.py in two places: * the pattern to match against functions at line 436 is modified: lambdas should be matched even if not preceded by whitespace, as long as "lambda" isn't part of another word. * the BlockFinder class is heavily modified. Changes are: - checking for "def", "class" or "lambda" names before setting self.started to True. Then checking the same line for word characters after the colon (if the colon is on that line). If so, and the line does not end with a line continuation marker, raise EndOfBlock immediately. - adding self.passline to show that the line is to be included and no more checking is necessary on that line. Since a NEWLINE token is not generated when a line continuation marker exists, this allows getsource to continue with these functions even if the following line would not be indented. Also add a bunch of 'quite-unlikely-to-occur-in-real-life-but-working-anyway' tests.
* Patch #736962: port test_inspect to unittest. As part of this, move outJohannes Gijsbers2004-12-121-395/+349
| | | | | the fodder modules to separate files to get rid of the imp.load_source() trickery.
* Patch #1006219: let inspect.getsource show '@' decorators and add tests forJohannes Gijsbers2004-08-181-0/+41
| | | | | this (which are rather ugly, but it'll have to do until test_inspect gets a major overhaul and a conversion to unittest). Thanks Simon Percivall!
* - Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)).Matthias Klose2004-08-151-0/+8
|
* [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback ↵Andrew M. Kuchling2004-06-051-2/+2
| | | | line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me.
* Patch #830858: Correct the number of is-functions. Backported to 2.3 and 2.2.Martin v. Löwis2003-10-311-0/+4
|
* Add a trivial test of getargspec() with a method.Jeremy Hylton2003-06-271-16/+21
|
* Refer to __builtin__.file, not __builtins__.fileMartin v. Löwis2003-05-031-2/+3
|
* Patch #711902: Cause pydoc to show data descriptor __doc__ strings.Martin v. Löwis2003-05-031-0/+3
|