Commit Graph

30652 Commits

Author SHA1 Message Date
Edward Loper 68ba9a685d In output_difference(), replace blank lines in `want` with <BLANKLINE>
(rather than replacing <BLANKLINE> with blank lines in `got`).  This
makes it easier to see what's intended.
2004-08-12 02:43:49 +00:00
Edward Loper a5db6009fe - Changed output of DocTestParser.get_program() to make it easier to
visually distinguish the expected output from the comments (use
  "##" to mark expected outputs, and "#" to mark comments).
- If the string given to DocTestParser.get_program() is indented, then
  strip its indentation.  (In particular, find the min indentation of
  non-blank lines, and strip that indentation from all lines.)
2004-08-12 02:41:30 +00:00
Edward Loper 8e4a34ba09 - Added __docformat__
- Added comments for some regexps
- If the traceback type/message don't match, then still print full
  traceback in report_failure (not just the first & last lines)
- Renamed DocTestRunner.__failure_header -> _failure_header
2004-08-12 02:34:27 +00:00
Edward Loper 74bca7aa44 - Changed option directives to be example-specific. (i.e., they now
modify option flags for a single example; they do not turn options
  on or off.)
- Added "indent" and "options" attributes for Example
- Got rid of add_newlines param to DocTestParser._parse_example (it's
  no longer needed; Example's constructor now takes care of it).
- Added some docstrings
2004-08-12 02:27:44 +00:00
Edward Loper ac20f57c28 - Added a register_optionflag function (so users can add their own
option flags); and use it to define the existing optionflag
  constants.
2004-08-12 02:02:24 +00:00
Fred Drake 568671fc0f avoid version numbers in the text where possible 2004-08-10 21:20:10 +00:00
Fred Drake ba100c98ad clarify the behavior of the .first() and .last() methods for empty
databases

this should be backported to the release23-maint branch
2004-08-10 19:22:48 +00:00
Andrew M. Kuchling f54ac7e0ee Spelling fix 2004-08-10 19:01:50 +00:00
Fred Drake d62d507b9a added missing documentation for UseForeignDTD() (new in 2.3)
someone should backport to the release23-maint branch
2004-08-10 17:18:32 +00:00
Fred Drake fb568ca52a add descriptions for many of the new error codes 2004-08-10 16:47:18 +00:00
Fred Drake 9d92d5a9ac minor changes to make this format again 2004-08-10 15:41:03 +00:00
Tim Peters c2388a2b9c Start rewriting doctest's LaTeX docs. Damn, this is slow going! 2004-08-10 01:41:28 +00:00
Piers Lauder 6a4e635beb Fix typo in getquotaroot parameter reported by Thierry FLORAC. Also amplify doc string for select to indicate proper way to obtain other responses. 2004-08-10 01:24:54 +00:00
Tim Peters 494aaee902 Whitespace normalization. 2004-08-09 18:54:11 +00:00
Andrew M. Kuchling 24884a5ccc [Patch #1005465] Markup tweaks 2004-08-09 17:36:56 +00:00
Andrew M. Kuchling e236b38731 [Patch #1005491 ] use __name__ == '__main__' in scripts 2004-08-09 17:27:55 +00:00
Tim Peters 6c542b731c Edward's latest checkins somehow managed to wipe out my previous latest
checkins.  Reapplying the latter changes.
2004-08-09 16:43:36 +00:00
Edward Loper a1ef6110ba - DocTest is now a simple container class; its constructor is no longer
responsible for parsing the string.
- Renamed Parser to DocTestParser
- DocTestParser.get_*() now accept the string & name as command-line
  arguments; the parser's constructor is now empty.
- Added DocTestParser.get_doctest() method
- Replaced "doctest_factory" argument to DocTestFinder with a "parser"
  argument (takes a DocTestParser).
- Changed _tag_msg to take an indentation string argument.
2004-08-09 16:14:41 +00:00
Tim Peters 413ced6c22 This started as a spelling and whitespace cleanup. The comment for
the set_trace fiddling didn't make sense to me, and I ended up reworking
that part of the code.  We really do want to save and restore
pdb.set_trace, so that each dynamically nested level of doctest gets
sys.stdout fiddled to what's appropriate for *it*.  The only "trick"
really needed is that these layers of set_trace wrappers each call the
original pdb.set_trace (instead of the current pdb.set_trace).
2004-08-09 15:43:47 +00:00
Jason Tishler 0d2a75c7b8 Patch #1006003: Cygwin standard module build problems
Add missing PyAPI_FUNC/PyAPI_DATA macros.
2004-08-09 15:02:30 +00:00
Andrew M. Kuchling 7f203b847b Add item 2004-08-09 14:48:28 +00:00
Fred Drake 151df0794d - make a module reference a hyperlink
- wrap a long line
2004-08-09 14:12:05 +00:00
Fred Drake 830d8b8b80 fix markup nit 2004-08-09 14:06:58 +00:00
Jason Tishler c246cb76e6 Bug #1001857: socketmodule does not build under cygwin
Restore clean building under Cygwin.
2004-08-09 13:25:59 +00:00
Jim Fulton 356fd19c31 Added support for pdb.set_trace. 2004-08-09 11:34:47 +00:00
Dave Cole 9dc19c2515 Ooops - for some reason I had the wrong versionadded... 2004-08-09 05:59:09 +00:00
Dave Cole 331708b226 Patch #1003700: Add socketpair function to socket module. 2004-08-09 04:51:41 +00:00
Tim Peters 80e53141b9 Removed lots of stuff from the module docstring. My intent for 2.4 is
to put details in the LaTeX docs instead, and lots of stuff in the
module docstring wasn't useful anyway.
2004-08-09 04:34:45 +00:00
Tim Peters 208ca7075f Repair some out-of-date comments. 2004-08-09 04:12:36 +00:00
Tim Peters bb43147312 Drop the excruciating newline requirements on arguments to
Example.__init__.  The constructor now adds trailing newlines when
needed, and no longer distinguishes between multi- and single-line
cases for source.
2004-08-09 03:51:46 +00:00
Tim Peters dd0e475297 Give return stmts their own lines. 2004-08-09 03:31:56 +00:00
Tim Peters d40a92b3f0 Indent body of _EXAMPLE_RE for readability. _IS_BLANK_OR_COMMENT makes
more sense as a callable.
2004-08-09 03:28:45 +00:00
Edward Loper 78b58f38f1 Changed Parser.get_examples() to return a list of Example objects,
rather than a list of triples.
2004-08-09 02:56:02 +00:00
Edward Loper 34fcb14768 - Split DocTestRunner's check_output and output_difference methods off
into their own class, OutputChecker.
- Added optional OutputChecker arguments to DocTestRunner,
  DocTestCase, DocTestSuite.
2004-08-09 02:45:41 +00:00
Edward Loper 7c748469c7 Rewrote Parser, using regular expressions instead of walking though
the string one line at a time.  The resulting code is (in my opinion,
anyway), much easier to read.  In the process, I found and fixed a
bug in the orginal parser's line numbering in error messages (it was
inconsistant between 0-based and 1-based).  Also, check for missing
blank lines after the prompt on all prompt lines, not just PS1 lines
(test added).
2004-08-09 02:06:06 +00:00
Edward Loper 103d26e851 Fixed doctest error (wrong prompts) 2004-08-09 02:03:30 +00:00
Brett Cannon 651dd52b3a Previous commit was viewed as "perverse". Changed to just cast the unused
variable to void..

Thanks to Sjoerd Mullender for the suggested change.
2004-08-08 21:21:18 +00:00
Raymond Hettinger 955d2b2168 Add a test for Context.copy(). 2004-08-08 20:17:45 +00:00
Tim Peters 0955f29703 Tell unittest that source files with "badsyntax" in their names should
raise SyntaxError.  test_compiler passes now on WinXP, at least in a
release-build non-O run.
2004-08-08 16:43:59 +00:00
Tim Peters 2a5f656d0c Renamed locals to better reflect their meanings. 2004-08-08 16:37:37 +00:00
Tim Peters b6ecc165f2 In verbose mode, display the name of each file before trying to compile
it.  Else when this fails, there's no way to tell which file it was
chewing on.
2004-08-08 16:32:54 +00:00
Tim Peters 83b57355a8 Brief xrange news. 2004-08-08 07:24:22 +00:00
Tim Peters feec4533e2 Bug 1003935: xrange overflows
Added XXX comment about why the undocumented PyRange_New() API function
is too broken to be worth the considerable pain of repairing.

Changed range_new() to stop using PyRange_New().  This fixes a variety
of bogus errors.  Nothing in the core uses PyRange_New() now.

Documented that xrange() is intended to be simple and fast, and that
CPython restricts its arguments, and length of its result sequence, to
native C longs.

Added some tests that failed before the patch, and repaired a test that
relied on a bogus OverflowError getting raised.
2004-08-08 07:17:39 +00:00
Tim Peters d976ab7caf Trimmed trailing whitespace. 2004-08-08 06:29:10 +00:00
Tim Peters f3f57473ed Get rid of the ignore_imports argument to DocTestFinder.find().
This got slammed in when find() was fixed to stop grabbing doctests
from modules imported *by* the module being tested.  Such tests cannot
be expected to succeed, since they'll be run with the current module's
globals.  Dozens of Zope3 doctests were failing because of that.

It wasn't clear why ignore_imports got added then.  Maybe it's because
some existing tests failed when the change was made.  Whatever, it's
a Bad Idea so it's gone now.

The only use of it was exceedingly obscure, in test_doctest's "Duplicate
Removal" test.  It was "needed" there because, as an artifact of running
a doctest inside a doctest, the func_globals of functions compiled in
the second-level doctest don't match the module globals, and so the
test-finder believed these functions were from a foreign module and
skipped them.  But that took a long time to figure out, and I actually
understand some of this stuff <0.9 wink>.

That problem was resolved by moving the source code for the second-level
doctest into an actual module (test/doctest_aliases.py).

The only remaining difficulty was that the test for the deprecated
Tester.rundict() then failed, because the test finder doesn't take
module=None at face value, trying to guess which module the user really
intended then.  Its guess wasn't appropriate for what Tester.rundict
needs when module=None is given to *it*, which is "no, there is no
module here, and I mean it".  So now passing module=False means exactly
that.  This is hokey, but ignore_imports=False was really a hack to worm
around that there was no way to tell the test-finder that module=None
*sometimes* means what it says.  There was no use case for the combination
of passing a real module with ignore_imports=False.
2004-08-08 06:11:48 +00:00
Raymond Hettinger 9fce44bc8c * Context.copy() now makes a deepcopy.
* Facilitate reloads of local thread.
2004-08-08 04:03:24 +00:00
Tim Peters 161c963276 Type in docstring. 2004-08-08 03:38:33 +00:00
Tim Peters 3ddd60a83b Also deprecated the old Tester class, which is no longer used by anything
except internal tests.
2004-08-08 02:43:33 +00:00
Tim Peters bafb1fed51 Deprecate the doctest.is_private() function. 2004-08-08 01:52:57 +00:00
Tim Peters f727c6c2c7 Deprecated testmod's useless & confusing isprivate gimmick.
Ripped out the docs for the new DocTestFinder's namefilter argument,
and renamed it to _namefilter; this only existed to support isprivate.
Removed the new DocTestFinder's objfilter argument.  No point adding
more cruft to a broken filtering design.
2004-08-08 01:48:59 +00:00