summaryrefslogtreecommitdiffstats
path: root/Lib/test/string_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Ensure that width and precision in string formatting test have type int, not ↵Serhiy Storchaka2013-01-191-12/+12
| | | | | | long. Fix a regression from changeset d544873d62e9 (issue #15989).
* Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-0/+15
| | | | | | | when result of PyInt_AsLong() or PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
* use the stricter PyMapping_Check (closes #15801)Benjamin Peterson2012-08-281-0/+3
|
* #12266: move the tests in test_unicode.Ezio Melotti2011-08-151-17/+0
|
* #12266: Fix str.capitalize() to correctly uppercase/lowercase titlecased and ↵Ezio Melotti2011-08-151-0/+17
| | | | cased non-letter characters.
* startswith and endswith don't accept None as slice index. Patch by Torsten ↵Jesus Cea2011-04-201-0/+57
| | | | Becker. (closes #11828)
* Merged revisions 86596 via svnmerge fromEzio Melotti2010-11-211-11/+11
| | | | | | | | | | 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. ........
* Strengthen test_unicode with explicit type checking for assertEqual tests.Florent Xicluna2010-09-131-1/+1
|
* Merged revisions 84470-84471,84566-84567,84759 via svnmerge fromFlorent Xicluna2010-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84470 | florent.xicluna | 2010-09-03 22:00:37 +0200 (ven., 03 sept. 2010) | 1 line Strengthen BytesWarning tests. ........ r84471 | florent.xicluna | 2010-09-03 22:23:40 +0200 (ven., 03 sept. 2010) | 1 line Typo ........ r84566 | florent.xicluna | 2010-09-06 22:27:15 +0200 (lun., 06 sept. 2010) | 1 line typo ........ r84567 | florent.xicluna | 2010-09-06 22:27:55 +0200 (lun., 06 sept. 2010) | 1 line typo ........ r84759 | florent.xicluna | 2010-09-13 04:28:18 +0200 (lun., 13 sept. 2010) | 1 line Reenable test_ucs4 and remove some duplicated lines. ........
* Issue #7849: Now the utility ``check_warnings`` verifies if the warnings areFlorent Xicluna2010-03-071-2/+1
| | | | effectively raised. A new utility ``check_py3k_warnings`` deals with py3k warnings.
* remove archaic functions from test_supportEzio Melotti2010-01-241-9/+9
|
* Remove silly conditional.Antoine Pitrou2010-01-021-4/+2
|
* Add tests for issue #7458: str.rfind() would crash when called with an invalidAntoine Pitrou2010-01-021-0/+6
| | | | | start value. The offending code itself was removed as part of #7462. This patch by Victor Stinner.
* Issue #7462: Implement the stringlib fast search algorithm for the `rfind`,Antoine Pitrou2010-01-021-2/+29
| | | | `rindex`, `rsplit` and `rpartition` methods. Patch by Florent Xicluna.
* Remove restriction on precision when formatting floats. This is theMark Dickinson2009-11-231-8/+1
| | | | | first step towards removing the %f -> %g switch (see issues 7117, 5859).
* #3967: Correct a crash in count() and find() methods of string-like objects.Amaury Forgeot d'Arc2008-09-261-0/+16
| | | | | | | | For example: "".count("xxxx", sys.maxint, 0) Reviewed by Benjamin Peterson. Will port to 2.5 and 3.0.
* Issue #3751: str.rpartition would perform a left-partition when called withAmaury Forgeot d'Arc2008-09-011-0/+5
| | | | | | a unicode argument. will backport.
* Merged revisions ↵Christian Heimes2008-03-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray ........ r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line Copied files from py3k w/o modifications ........ r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines Take One * Added initialization code, warnings, flags etc. to the appropriate places * Added new buffer interface to string type * Modified tests * Modified Makefile.pre.in to compile the new files * Added bytesobject.c to Python.h ........ r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines Disabled bytearray.extend for now since it causes an infinite recursion Fixed serveral unit tests ........ r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines Added PyBytes support to several places: str + bytearray ord(bytearray) bytearray(str, encoding) ........ r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line Fixed more unit tests related to type('') is not unicode ........ r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines Fixed more unit tests Fixed bytearray.extend ........ r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line Implemented old buffer interface for bytearray ........ r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line Added backport of the io module ........ r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte ........ r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines Fixed more tests Fixed bytearray() comparsion with unicode() Fixed iterator assignment of bytearray ........ r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines str(bytesarray()) now returns the bytes and not the representation of the bytearray object Enabled and fixed more unit tests ........ r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines Clear error PyNumber_AsSsize_t() fails Use CHARMASK for ob_svall access disabled a test with memoryview again ........ r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line Untested updates to the PCBuild directory ........ r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed. ........ r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines Disabled last failing test I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out. ........ r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytes warning code ........ r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass. ........ r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytearray subclassing - all tests are passing. ........
* Issue 1742669. Now %d accepts very big float numbers.Facundo Batista2008-02-241-0/+9
| | | | Thanks Gabriel Genellina.
* Now in find, rfind, index, and rindex, you can use None as defaults,Facundo Batista2007-11-161-0/+28
| | | | | | | | | | | | as usual with slicing (both with str and unicode strings). This fixes issue 1259. For str only the stringobject.c file was modified. But for unicode, I needed to repeat in the four functions a lot of code, so created a new function that does part of the job for them (and placed it in find.h, following a suggestion of Barry). Also added tests for this behaviour.
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-281-2/+12
| | | | | | | | | | | | | | | | | | | | - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality.
* Fix a bug when there was a newline in the string expandtabs was called on.Neal Norwitz2007-06-111-0/+5
| | | | | | This also catches another condition that can overflow. Will backport.
* Fix those parts in the testsuite that assumed that sys.maxint would cause ↵Kristján Valur Jónsson2007-05-031-2/+2
| | | | overflow on x64. Now the testsuite is well behaved on that platform.
* Whitespace normalization. Ugh, we really need to do this more often.Neal Norwitz2007-04-251-2/+2
| | | | You might want to review this change as it's my first time. Be gentle. :-)
* SF 1193128: Let str.translate(None) be an identity transformationRaymond Hettinger2007-04-121-0/+3
|
* 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
|