added test script and expected output file as well
this closes patch 103297.
__all__ attributes will be added to other modules without first submitting
a patch, just adding the necessary line to the test script to verify
more-or-less correct implementation.
(I realize that I didn't really test this, because all the tests
succeed, so verify() never raised an AssertionError -- but the test
suite still succeeds, so I'm not too worried.)
implementation details inside the ucnhash module.
also cleaned up the unicode copyright blurb a little; Secret Labs'
internal revision history isn't that interesting...
and replaces them with a new API verify(). As a result the regression
suite will also perform its tests in optimization mode.
Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
except that it always returns Unicode objects.
A new C API PyObject_Unicode() is also provided.
This closes patch #101664.
Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
__getattr__() method, which clearly (like the other methods) was
intended to pass the __getattr__() call on to the self.err object,
mistakenly returned getattr(self, self.err) rather than
getattr(self.err, attr). Since self.err is not a string, this always
raises a TypeError. Apparently that doesn't bother for the one
attribute for which __getattr__() is actually called ('__coerce__'),
but it broke the rich comparisons stuff that I'm trying to get into
shape, so I'm fixing this now. (I could also simply remove the
__getattr__() method, but fixing it seems more in the spirit of what
the ComparableException class is trying to do.)
in case the parameters are out of bounds and fixes error handling
for .count(), .startswith() and .endswith() for the case of
mixed string/Unicode objects.
This patch adds Python style index semantics to PyUnicode_Count()
indices (including the special handling of negative indices).
The patch is an extended version of patch #103249 submitted
by Michael Hudson (mwh) on SF. It also includes new test cases.
message, and tries to make the messages more consistent and helpful when
the wrong number of arguments or duplicate keyword arguments are supplied.
Comes with more tests for test_extcall.py and and an update to an error
message in test/output/test_pyexpat.
uppercase strings also when the IGNORECASE flag is set (bug #128899)
(also added test cases for recently fixed bugs to the regression suite
-- or in other words, check in re_tests.py too...)
(bugs #115903, #115696)
This is based on a patch by Darrel Gallion. I'm not 100%
sure about this fix, but I haven't managed to come up with
any test case it cannot handle...
-- added some more docstrings
-- fixed typo in scanner class (#125531)
-- the multiline flag (?m) should't affect the \Z operator (#127259)
-- fixed non-greedy backtracking bug (#123769, #127259)
-- added sre.DEBUG flag (currently dumps the parsed pattern structure)
-- fixed a couple of glitches in groupdict (the #126587 memory leak
had already been fixed by AMK)
pid across threads (but in that case, it's still the same process, and so
still sharing the "template" cache in tempfile.py). Repaired that, and
added a new std test.
On Linux, someone please run that standalone with more files and/or more
threads; e.g.,
python lib/test/test_threadedtempfile.py -f 1000 -t 10
to run with 10 threads each creating (and deleting) 1000 temp files.
codec to test all charmap codec features.
As side-effect of moving the test codec into a new module, the encodings
package codec import mechanism is checked as well.
Wasn't built on Windows; not in config.c either.
Module init function missing DL_EXPORT magic.
test_xreadline output file obviously wrong (started w/ "test_xrl").
test program very unclear about what was expected.
variant that never needs to "search from the right".
Also fixed unlikely memory leak in get_line, if string size overflows INTMAX.
Also new std test test_bufio to make sure .readline() works.
the mapping dictionaries can now contain 1-n mappings, meaning
that character ordinals may be mapped to strings or Unicode object,
e.g. 0x0078 ('x') -> u"abc", causing the ordinal to be replaced by
the complete string or Unicode object instead of just one character.
Another feature introduced by the patch is that of mapping oridnals to
the emtpy string. This allows removing characters.
The patch is different from patch #103100 in that it does not cause a
performance hit for the normal use case of 1-1 mappings.
Written by Marc-Andre Lemburg, copyright assigned to Guido van Rossum.
the urljoin() function, which exercises the urlparse() and urlunparse()
functions as side effects.
(Moshe, why did we have perfectly empty tests checked in for this?)
an empty keywords dictionary (via apply() or the extended call syntax),
the keywords dict should be ignored. If the keywords dict is not empty,
TypeError should be raised. (Between the restructuring of the call
machinery and this patch, an empty dict in this situation would trigger
a SystemError via PyErr_BadInternalCall().)
Added regression tests to detect errors for this.
codec to not apply Latin-1 mappings for keys which are not found
in the mapping dictionaries, but instead treat them as undefined
mappings.
The patch was originally written by Martin v. Loewis with some
additional (cosmetic) changes and an updated test script
by Marc-Andre Lemburg.
The standard codecs were recreated from the most current files
available at the Unicode.org site using the Tools/scripts/gencodec.py
tool.
This patch closes the bugs #116285 and #119960.
1. When running in verbose mode, if any test happens to pass, print
a warning that the apparent success may be bogus (stdout isn't
compared in verbose mode). Been fooled by that too often.
2. When a test fails because the expected stdout doesn't match the
actual stdout, print as much of stdout as did match before the
first failing write. Else we get failures of the form "expected
'a', got 'b'" and a glance at the expected output file shows
500 instances of 'a' -- no idea where it failed, and, as in #1,
trying to run in verbose mode instead doesn't help because
stdout isn't compared then.
Christmas present to myself: the bisect module didn't define what
happened if the new element was already in the list. It so happens
that it inserted the new element "to the right" of all equal elements.
Since it wasn't defined, among other bad implications it was a mystery
how to use bisect to determine whether an element was already in the
list (I've seen code that *assumed* "to the right" without justification).
Added new methods bisect_left and insort_left that insert "to the left"
instead; made the old names bisect and insort aliases for the new names
bisect_right and insort_right; beefed up docstrings to explain what
these actually do; and added a std test for the bisect module.
information from the Expat library that is not part of its public API.
Do not print this information as the format of the string may (and will)
change as Expat evolves.
Add additional tests to make sure the ParserCreate() function raises the
right exceptions on illegal parameters.
roundtrip(): Show the offending syntax tree when things break; this makes
it a little easier to debug the module by adding test cases.
(Still need better tests for this module, but there's not enough time
today.)
also test join method of 8-bit strings.
Also changed the test() function to (1) compare the types of the
expected and actual result, and (2) in verbose mode, print the repr()
of the output.
testAAA(),
testAAB(): Added checks that the results are right.
testTooManyDocumentElements(): Added code to actually test this.
testCloneElementDeep()
testCloneElementShallow(): Filled these in with test code.
_testCloneElementCopiesAttributes(),
_setupCloneElement(): Helper functions used with the other
testCloneElement*() functions.
testCloneElementShallowCopiesAttributes(): No longer a separate test;
_setupCloneElement() uses _testCloneElementCopiesAttributes() to
test that this is always done.
testNormalize(): Added to check Node.normalize().
When a method is called with no regular arguments and * args, defer
the first arg is subclass check until after the * args have been
expanded.
N.B. The CALL_FUNCTION implementation is getting really hairy; should
review it to see if it can be simplified.
-- fixed negative lookbehind to work correctly at the beginning
of the target string (bug #117242)
-- improved syntax check; you can no longer refer to a group
inside itself (bug #110866)
First, only report garbage that the GC cannot free. Second, only report
the number of objects found, not their repr(). People can dig deeper on
their own if they find a leak.
Let's hope this is correct (I'm not sure why the sys.platform would be
'Darwin1.2' rather than 'darwin1', which seems to be the convention).
Someone with Darwin please test this!
libm result is 0). Cautiously add a few libm exception test cases:
1. That exp(-huge) returns 0 without exception.
2. That exp(+huge) triggers OverflowError.
3. That sqrt(-1) raises ValueError specifically (apparently under glibc linked
with -lieee, it was raising OverflowError due to an accident of the way
mathmodule.c's CHECK() macro happened to deal with Infs and NaNs under gcc).
driver code, so that each test gets this; it had been done inconsistently.
Remove the lines that set the variables holding dom objects to None; not
needed since the interpreter cleans up locals on function return.
read the header from the .au file and do a sanity check
pass only the data to the audio device
call flush() so that program does not exit until playback is complete
call all the other methods to verify that they work minimally
call setparameters with a bunch of bugs arguments
linuxaudiodev.c:
use explicit O_WRONLY and O_RDONLY instead of 1 and 0
add a string name to each of the entries in audio_types[]
add AFMT_A_LAW to the list of known formats
add x_mode attribute to lad object, stores imode from open call
test ioctl return value as == -1, not < 0
in read() method, resize string before return
add getptr() method, that calls does ioctl on GETIPTR or GETOPTR
depending on x_mode
in setparameters() method, do better error checking and raise
ValueErrors; also use ioctl calls recommended by Open Sound
System Programmer's Guido (www.opensound.com)
use PyModule_AddXXX to define names in module
raise ValueError. Checked in the patch as far as it went, but also changed
all of ints, longs and floats to raise ZeroDivisionError instead when raising
0 to a negative number. This is what 754-inspired stds require, as the "true
result" is an infinity obtained from finite operands, i.e. it's a singularity.
Also changed float pow to not be so timid about using its square-and-multiply
algorithm. Note that what math.pow does is unrelated to what builtin pow
does, and will still vary by platform.
apparently not considered a terminal, and so isatty(3) returns false. So we
skip the test for ttyness of the master side and just check the slave side,
which should really be a terminal.
cStringIO does not get it right (reported as SF bug #115531).
Added test for ValueError when write() is called on a closed StringIO
object. Commented out because cStringIO does not get it right
(reported as SF bug #115530).
flag is true, is set to a StringIO object that silently collects all
debug messages. This is triggered by the Node._debug=1 statement at
the top of test_minidom.py. After the tests, we better delete that
StringIO object to avoid wasting memory. We also reset the _debug
flag. (Note that this is an undetectable memory leak, and the memory
doesn't get collected by the cycle-gc either, because it's all
reachable -- it's just useless.)
Note a curious extension to the std C rules: x, X and o formatting can never produce
a sign character in C, so the '+' and ' ' flags are meaningless for them. But
unbounded ints *can* produce a sign character under these conversions (no fixed-
width bitstring is wide enough to hold all negative values in 2's-comp form). So
these flags become meaningful in Python when formatting a Python long which is too
big to fit in a C long. This required shuffling around existing code, which hacked
x and X conversions to death when both the '#' and '0' flags were specified: the
hacks weren't strong enough to deal with the simultaneous possibility of the ' ' or
'+' flags too, since signs were always meaningless before for x and X conversions.
Isomorphic shuffling was required in unicodeobject.c.
Also added dozens of non-trivial new unbounded-int test cases to test_format.py.
which implements the automatic conversion from Unicode to a string
object using the default encoding.
The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.
As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.
reverse() didn't work at all due to bad arg check.
Fixed that.
Added Brad Chapman to ACKS file, as the proud new owner of two
implicitly copyrighted lines of Python source code <wink>.
Repaired buffer_info's total lack of arg-checking.
Replaced memmove by memcpy in reverse() guts, as memmove is
often slower and the memory areas are guaranteed disjoint.
Replaced poke-and-hope unchecked decl of tmp buffer size by
assert-checked larger tmp buffer.
Got rid of inconsistent spaces before open paren in docstrings.
Added reverse() sanity tests to test_array.py.
Strings are unpickled by calling eval on the string's repr. This
change makes pickle work like cPickle; it checks if the pickled
string is safe to eval and raises ValueError if it is not.
test suite modifications:
Verify that pickle catches a variety of insecure string pickles
Make test_pickle and test_cpickle use exactly the same test suite
Add test for pickling recursive object
character according to RFC 2396. Add some text to quote doc string
that explains the quoting rules better.
This closes SF Bug #114427.
Add _fast_quote operation that uses a dictionary instead of a list
when the standard set of safe characters is used.
waste an hour tracking down an illusion; repaired it; writing/reading non-
printable characters (except \t\r\n) into/outof text-mode files ain't
defined x-platform, and at least some Windows text editors do surprising
things in their presence.
Also added a by-hand "build humber" to the Windows build, in an approximation
of Python's inexplicable BUILD-number Unix scheme. I'll try to remember to
increment it each time I make a Windows installer available. It's starting
at 2, cuz I've put 2 installers out so far (both with BUILD #0).
This was a funny one! The test very subtly relied on 1.5.2's
behavior of treating "\x%" as "\x%", i.e. ignoring that was an
\x escape that didn't make sense. But /F implemented PEP 223,
which causes 2.0 to raise an exception on the bad escape.
Fixed by merely making the 3 such strings of this kind into
raw strings.
newlines at the start or end. Fiddle test_popen2 and popen2._test() to
tolerate this. Also change all "assert"s in these tests to raise
explicit exceptions, so that python -O doesn't render them useless.
Also, in case of error, make the msg display the reprs of what we
wrote and what we read, so we can tell exactly why it's failing.