summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some endcase bugs in unicode rfind()/rindex() and endswith().Guido van Rossum2002-08-201-0/+6
| | | | | | These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases.
* Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.Marc-André Lemburg2002-08-111-0/+8
| | | | | | | u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581.
* Unicode replace() method with empty pattern argument should fail, likeGuido van Rossum2002-08-091-0/+6
| | | | it does for 8-bit strings.
* Expanded the unittests for the new width sensitive PyUnicode_Contains().Raymond Hettinger2002-08-061-0/+6
|
* Added a test for PyUnicode_Contains() taking into account the width ofBarry Warsaw2002-08-061-0/+1
| | | | Py_UNICODE.
* Committing patch #591250 which provides "str1 in str2" when str1 is aBarry Warsaw2002-08-061-18/+57
| | | | string of longer than 1 character.
* Add encoding declaration.Martin v. Löwis2002-08-041-0/+1
|
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Whitespace normalization.Tim Peters2002-05-231-1/+1
|
* Apply patch diff.txt from SF feature requestWalter Dörwald2002-04-221-0/+18
| | | | | | | | | http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument.
* Apply diff3.txt from SF patch http://www.python.org/sf/536241Walter Dörwald2002-04-171-0/+22
| | | | | | | | | If a str or unicode method returns the original object, make sure that for str and unicode subclasses the original will not be returned. This should prevent SF bug http://www.python.org/sf/460020 from reappearing.
* Whitespace normalization.Tim Peters2002-04-161-1/+1
|
* Apply the second version of SF patch http://www.python.org/sf/536241Walter Dörwald2002-04-151-2/+12
| | | | | | | | | | Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62)
* Added test case for UTF-8 encoding bug #541828.Marc-André Lemburg2002-04-101-0/+16
|
* Add the 'bool' type and its values 'False' and 'True', as described inGuido van Rossum2002-04-031-72/+72
| | | | | | | | | | | | | PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates.
* As part of fixing bug #536241, add a test case for string.zfill() with UnicodeAndrew M. Kuchling2002-03-291-1/+4
|
* Do not insert characters for unicode-escape decoders if the error modeMartin v. Löwis2002-03-211-0/+8
| | | | is "ignore". Fixes #529104.
* Fix to the UTF-8 encoder: it failed on 0-length input strings.Marc-André Lemburg2002-02-071-23/+33
| | | | | | | | | | | | | | Fix for the UTF-8 decoder: it will now accept isolated surrogates (previously it raised an exception which causes round-trips to fail). Added new tests for UTF-8 round-trip safety (we rely on UTF-8 for marshalling Unicode objects, so we better make sure it works for all Unicode code points, including isolated surrogates). Bumped the PYC magic in a non-standard way -- please review. This was needed because the old PYC format used illegal UTF-8 sequences for isolated high surrogates which now raise an exception.
* Fix for the UTF-8 memory allocation bug and the UTF-8 encodingMarc-André Lemburg2002-02-061-12/+11
| | | | bug related to lone high surrogates.
* Skipping some tests by adding the usual jython conditional test around:Finn Bock2001-12-101-24/+27
| | | | | | | | | - the repr of unicode. Jython only add the u'' if the string contains char values > 255. - A unicode arg to unicode() is perfectly valid in jython. - A test buffer() test. No buffer() on Jython This closes patch "[ #490920 ] Jython and test_unicode".
* Whitespace normalization.Tim Peters2001-12-011-1/+0
|
* Adding test for Unicode repr()-output.Marc-André Lemburg2001-11-281-0/+15
|
* Fix for bug #438164: %-formatting using Unicode objects.Marc-André Lemburg2001-11-201-4/+1
| | | | | This patch also does away with an incompatibility between Jython and CPython.
* Fix for bug #480188: printing unicode objectsMarc-André Lemburg2001-11-201-0/+13
|
* Additional test and documentation for the unicode() changes.Marc-André Lemburg2001-10-191-21/+61
| | | | This patch should also be applied to the 2.2b1 trunk.
* Whitespace normalization.Tim Peters2001-10-041-1/+1
|
* Add tests for repr() of strings containing string quotes as well.Guido van Rossum2001-09-211-0/+4
|
* Test basic functioning of unicode repr(). (If this breaks Jython,Guido van Rossum2001-09-211-0/+11
| | | | please let me know and we'll figure out how to fix the test.)
* Implement the changes proposed in patch #413333. unicode(obj) nowMarc-André Lemburg2001-09-201-0/+5
| | | | | works just like str(obj) in that it tries __str__/tp_str on the object in case it finds that the object is not a string or buffer.
* Patch #435971: UTF-7 codec by Brian Quinlan.Marc-André Lemburg2001-09-201-1/+28
|
* Fix for bug #444493: u'\U00010001' segfaults with current CVS onMarc-André Lemburg2001-07-251-1/+2
| | | | wide builds.
* Make the unicode-escape and the UTF-16 codecs handle surrogatesMarc-André Lemburg2001-07-201-0/+8
| | | | | | | | correctly and thus roundtrip-safe. Some minor cleanups of the code. Added tests for the roundtrip-safety.
* Encode surrogates in UTF-8 even for a wide Py_UNICODE.Martin v. Löwis2001-06-271-2/+2
| | | | | | | Implement sys.maxunicode. Explicitly wrap around upper/lower computations for wide Py_UNICODE. When decoding large characters with UTF-8, represent expected test results using the \U notation.
* Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".Tim Peters2001-05-131-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints <sigh>, can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering.
* Fix for bug #417030: "print '%*s' fails for unicode string"Marc-André Lemburg2001-05-021-0/+6
|
* Patch by Finn Bock to make test_unicode.py work for Jython.Marc-André Lemburg2001-02-101-5/+10
|
* Fixed .capitalize() method of Unicode objects to work like theMarc-André Lemburg2001-01-291-0/+2
| | | | | | corresponding string method. Added tests for this too. Patch written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Change verify() function to raise TestFailed, not AssertionError.Guido van Rossum2001-01-191-6/+6
| | | | | | (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.)
* Whitespace normalization. Leaving tokenize_tests.py alone for now.Tim Peters2001-01-181-6/+6
|
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-93/+93
| | | | | | | 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.
* Added checks to prevent PyUnicode_Count() from dumping coreMarc-André Lemburg2001-01-161-0/+7
| | | | | | | | | | | | 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.
* This patch changes the default behaviour of the builtin charmapMarc-André Lemburg2001-01-031-2/+3
| | | | | | | | | | | | | | | | 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.
* Test more split argument combinations:Guido van Rossum2000-12-191-0/+7
| | | | | | 1) multi-char separator 2) multi-char separator that only occurs at last position 3) all of the above with mixed Unicode and 8-bit-string arguments
* Slight improvement to Unicode test suite, inspired by patch #102563:Guido van Rossum2000-11-291-9/+11
| | | | | | | | 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.
* Make reindent.py happy (convert everything to 4-space indents!).Fred Drake2000-10-231-43/+42
|
* Updated test with a case which checks for the bug reported inMarc-André Lemburg2000-10-071-0/+1
|
* Removing UTF-16 aware Unicode comparison code. This kind of compareMarc-André Lemburg2000-08-081-50/+53
| | | | | | | function (together with other locale aware ones) should into a new collation support module. See python-dev for a discussion of this removal. Note: This patch should also be applied to the 1.6 branch.
* Tests for new surrogate support in the UTF-8 codec. By Bill Tutt.Marc-André Lemburg2000-07-071-0/+72
|
* Tests for new instance support in unicode().Marc-André Lemburg2000-07-071-0/+15
|
* Added tests for the new .isalpha() and .isalnum() methods.Marc-André Lemburg2000-07-051-0/+16
|