summaryrefslogtreecommitdiffstats
path: root/Lib/test/string_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix endcase for str.rpartition()Raymond Hettinger2006-09-041-1/+1
|
* Bug #1515471: string.replace() accepts character buffers again.Neal Norwitz2006-07-301-2/+7
| | | | Pass the char* and size around rather than PyObject's.
* Apply perky's fix for #1503157: "/".join([u"", u""]) raising OverflowError.Georg Brandl2006-06-101-0/+2
| | | | Also improve error message on overflow.
* RFE #1491485: str/unicode.endswith()/startswith() now accept a tuple as ↵Georg Brandl2006-06-091-1/+31
| | | | first argument.
* Re-enable a new empty-string test added during the NFS sprint,Tim Peters2006-06-011-6/+1
| | | | | | but disabled then because str and unicode strings gave different results. The implementations were repaired later during the sprint, but the new test remained disabled.
* changed count to return 0 for slices outside the source stringFredrik Lundh2006-05-301-1/+2
|
* changed find/rfind to return -1 for matches outside the source stringFredrik Lundh2006-05-301-0/+8
|
* fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying onFredrik Lundh2006-05-291-0/+8
| | | | the current behaviour ;-)
* needspeed: rpartition documentation, tests, and a bug fixes.Fredrik Lundh2006-05-261-2/+17
| | | | feel free to add more tests and improve the documentation.
* Test for more edge strip cases; leading and trailing separator gets removedAndrew Dalke2006-05-261-0/+2
| | | | even with strip(..., 0)
* Added more rstrip tests, including for prealloc'ed arraysAndrew Dalke2006-05-261-1/+54
|
* Test cases for off-by-one errors in string split with multicharacter pattern.Andrew Dalke2006-05-261-0/+2
|
* I like tests.Andrew Dalke2006-05-261-0/+32
| | | | | | | The new split functions use a preallocated list. Added tests which exceed the preallocation size, to exercise list appends/resizes. Also added more edge case tests.
* Added split whitespace checks for characters other than space.Andrew Dalke2006-05-261-0/+1
|
* Added a few more test cases for whitespace split. These strings have ↵Andrew Dalke2006-05-261-0/+7
| | | | leading whitespace.
* needforspeed: partition implementation, part two.Fredrik Lundh2006-05-261-0/+15
| | | | feel free to improve the documentation and the docstrings.
* Whitespace normalization.Tim Peters2006-05-251-2/+2
|
* needforspeed: check for overflow in replace (from Andrew Dalke)Fredrik Lundh2006-05-251-9/+8
|
* Added tests for implementation error we came up with in the need for speed ↵Andrew Dalke2006-05-251-0/+19
| | | | sprint.
* Disable the damn empty-string replace test -- it can'tTim Peters2006-05-241-2/+2
| | | | | be make to pass now for unicode if it passes for str, or vice versa.
* We can't leave the checked-in tests broken.Tim Peters2006-05-241-5/+10
|
* Added a slew of test for string replace, based various corner cases fromAndrew Dalke2006-05-241-0/+157
| | | | | | | | | | the Need For Speed sprint coding. Includes commented out overflow tests which will be uncommented once the code is fixed. This test will break the 8-bit string tests because "".replace("", "A") == "" when it should == "A" We have a fix for it, which should be added tomorrow.
* Merge ssize_t branch.Martin v. Löwis2006-02-151-1/+3
|
* Fix bug:Michael W. Hudson2005-10-211-0/+9
| | | | | | | | [ 1327110 ] wrong TypeError traceback in generator expressions by removing the code that can stomp on the users' TypeError raised by the iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly reasonable message itself. Also, a couple of tests.
* Disable encoding/decoding test, if unicode is disabled.Walter Dörwald2005-07-281-19/+20
|
* * Beef-up tests for str.count().Raymond Hettinger2005-02-201-0/+28
| | | | * Speed-up str.count() by using memchr() to fly between first char matches.
* * Beef-up testing of str.__contains__() and str.find().Raymond Hettinger2005-02-201-0/+24
| | | | | | | | | | | | | | | | | | | * Speed-up "x in y" where x has more than one character. The existing code made excessive calls to the expensive memcmp() function. The new code uses memchr() to rapidly find a start point for memcmp(). In addition to knowing that the first character is a match, the new code also checks that the last character is a match. This significantly reduces the incidence of false starts (saving memcmp() calls and making quadratic behavior less likely). Improves the timings on: python -m timeit -r7 -s"x='a'*1000" "'ab' in x" python -m timeit -r7 -s"x='a'*1000" "'bc' in x" Once this code has proven itself, then string_find_internal() should refer to it rather than running its own version. Also, something similar may apply to unicode objects.
* SF bug #1054139: serious string hashing error in 2.4b1Raymond Hettinger2004-10-261-0/+9
| | | | | _PyString_Resize() readied strings for mutation but did not invalidate the cached hash value.
* test_bug1001011(): Verify thatTim Peters2004-08-271-5/+33
| | | | | | | | | s.join([t]) is t for (s, t) in (str, str), (unicode, unicode), and (str, unicode). For (unicode, str), verify that it's *not* t (the result is promoted to unicode instead). Also verify that when t is a subclass of str or unicode that "the right thing" happens.
* Move test_bug1001011() to string_tests.MixinStrUnicodeTest so thatWalter Dörwald2004-08-261-0/+19
| | | | | | it can be used for str and unicode. Drop the test for "".join([s]) is s because this is an implementation detail (and doesn't work for unicode)
* SF #989185: Drop unicode.iswide() and unicode.width() and addHye-Shik Chang2004-08-041-25/+0
| | | | | | | | | | | | unicodedata.east_asian_width(). You can still implement your own simple width() function using it like this: def width(u): w = 0 for c in unicodedata.normalize('NFC', u): cwidth = unicodedata.east_asian_width(c) if cwidth in ('W', 'F'): w += 2 else: w += 1 return w
* Add iswide() and width() method for UserString according as theHye-Shik Chang2004-06-041-0/+25
| | | | addition to unicode objects.
* [SF #866875] Add a specialized routine for one characterHye-Shik Chang2004-01-051-14/+55
| | | | separaters on str.split() and str.rsplit().
* Fix unicode.rsplit()'s bug that ignores separater on the end of string whenHye-Shik Chang2003-12-231-0/+2
| | | | using specialized splitter for 1 char sep.
* Add rsplit method for str and unicode builtin types.Hye-Shik Chang2003-12-151-0/+20
| | | | | SF feature request #801847. Original patch is written by Sean Reifschneider.
* Add optional fillchar argument to ljust(), rjust(), and center() string methods.Raymond Hettinger2003-11-261-3/+3
|
* SF bug #795506: Wrong handling of string format code for float values.Raymond Hettinger2003-08-271-0/+1
| | | | | | Adding missing support for '%F'. Will backport to 2.3.1.
* Whitespace normalization.Tim Peters2003-04-241-1/+0
|
* Attempt to make all the various string *strip methods the same.Neal Norwitz2003-04-101-28/+27
| | | | | | | | | | | * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent.
* Fix PyString_Format() so that '%c' % u'a' returns u'a'Walter Dörwald2003-03-311-0/+1
| | | | | | | | instead of raising a TypeError. (From SF patch #710127) Add tests to verify this is fixed. Add various tests for '%c' % int.
* Add two tests for simple error cases.Walter Dörwald2003-03-261-0/+4
|
* Get test to work on alphaNeal Norwitz2003-02-231-1/+1
|
* Port all string tests to PyUnit and share as much testsWalter Dörwald2003-02-211-317/+616
| | | | | | | between str, unicode, UserString and the string module as possible. This increases code coverage in stringobject.c from 83% to 86% and should help keep the string classes in sync in the future. From SF patch #662807
* Patch #650653: Raise always value error if the table is not 256 bytes long.Martin v. Löwis2002-12-121-0/+2
|
* check for str.__mod__Neil Schemenauer2002-11-181-0/+3
|
* Code by Inyeol Lee, submitted to SF bug 595350, to implementGuido van Rossum2002-08-231-0/+4
| | | | | the string/unicode method .replace() with a zero-lengt first argument. Inyeol contributed tests for this too.
* Moved inplace add and multiply methods from UserString to MutableString.Raymond Hettinger2002-08-091-0/+6
| | | | | Closes SF Bug #592573 where inplace add mutated a UserString. Added unittests to verify the bug is cleared.
* Revised the test suite for 'contains' to use the test() function argumentRaymond Hettinger2002-08-091-9/+9
| | | | | rather than vereq(). While it was effectively testing regular strings, it ignored the test() function argument when called by test_userstring.py.
* Whitespace normalization.Tim Peters2002-08-081-1/+0
|
* Committing patch #591250 which provides "str1 in str2" when str1 is aBarry Warsaw2002-08-061-1/+21
| | | | string of longer than 1 character.