summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
Commit message (Collapse)AuthorAgeFilesLines
* Move test_bug1001011() to string_tests.MixinStrUnicodeTest so thatWalter Dörwald2004-08-261-1/+2
| | | | | | 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-2/+1
| | | | | | | | | | | | 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
* Let u'%s' % obj try obj.__unicode__() first and fallback to obj.__str__().Marc-André Lemburg2004-07-231-0/+8
|
* Reuse width/iswide tests from strings_test. (Suggested by Walter Dörwald)Hye-Shik Chang2004-06-041-21/+2
|
* Fix typo.Hye-Shik Chang2004-06-041-1/+1
|
* - SF #962502: Add two more methods for unicode type; width() andHye-Shik Chang2004-06-021-0/+20
| | | | | | | iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis)
* Fix reallocation bug in unicode.translate(): The code was comparingWalter Dörwald2004-02-051-0/+1
| | | | characters instead of character pointers to determine space requirements.
* Fix for SF bug [ 817156 ] invalid \U escape gives 0=length unistr.Jeremy Hylton2003-10-061-0/+7
|
* Support trailing dots in DNS names. Fixes #782510. Will backport to 2.3.Martin v. Löwis2003-08-051-0/+4
|
* Consider \U-escapes in raw-unicode-escape. Fixes #444514.Martin v. Löwis2003-05-181-0/+7
|
* Combine the functionality of test_support.run_unittest()Walter Dörwald2003-05-011-3/+1
| | | | | | | | | | and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
* Change formatchar(), so that u"%c" % 0xffffffff now raisesWalter Dörwald2003-04-021-1/+1
| | | | | an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127.
* Remove duplicate test.Walter Dörwald2003-03-311-2/+2
|
* Fix PyString_Format() so that '%c' % u'a' returns u'a'Walter Dörwald2003-03-311-0/+3
| | | | | | | | instead of raising a TypeError. (From SF patch #710127) Add tests to verify this is fixed. Add various tests for '%c' % int.
* Port all string tests to PyUnit and share as much testsWalter Dörwald2003-02-211-492/+132
| | | | | | | 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
* Add a few tests to test_count() to increase coverage inWalter Dörwald2003-02-101-0/+6
| | | | Object/unicodeobject.c::unicode_count().
* Fix copy&paste error: call title instead of countWalter Dörwald2003-02-101-1/+1
|
* Port test_unicode.py to PyUnit and add tests for errorWalter Dörwald2003-01-191-851/+1039
| | | | | | cases and a few methods. This increases code coverage in Objects/unicodeobject.c from 81% to 85%. (From SF patch #662807)
* Add a test that exercises the error handling part ofWalter Dörwald2003-01-081-0/+6
| | | | PyUnicode_EncodeDecimal().
* Patch for bug #659709: bogus computation of float lengthMarc-André Lemburg2002-12-291-0/+25
| | | | | Python 2.2.x backport candidate. (This bug has been around since Python 1.6.)
* check for unicode.__mod__Neil Schemenauer2002-11-181-0/+1
|
* Fix for bug #626172: crash using unicode latin1 single charMarc-André Lemburg2002-10-231-0/+6
| | | | Python 2.2.3 candidate.
* Don't test whether surrogate sequences round-trip in UTF-8. 2.2.2 candidate.Martin v. Löwis2002-09-141-1/+4
|
* Use integer above sys.maxunicode for range test. Fixes #608884.Martin v. Löwis2002-09-141-2/+2
| | | | 2.2.2 candidate.
* Change the unicode.translate docstring to document thatWalter Dörwald2002-09-041-0/+2
| | | | | | | | | | Unicode strings (with arbitrary length) are allowed as entries in the unicode.translate mapping. Add a test case for multicharacter replacements. (Multicharacter replacements were enabled by the PEP 293 patch)
* Fix SF bug 599128, submitted by Inyeol Lee: .replace() would do theGuido van Rossum2002-08-231-0/+2
| | | | | | | | | | | | | wrong thing for a unicode subclass when there were zero string replacements. The example given in the SF bug report was only one way to trigger this; replacing a string of length >= 2 that's not found is another. The code would actually write outside allocated memory if replacement string was longer than the search string. (I wonder how many more of these are lurking? The unicode code base is full of wonders.) Bugfix candidate; this same bug is present in 2.2.1.
* Code by Inyeol Lee, submitted to SF bug 595350, to implementGuido van Rossum2002-08-231-6/+4
| | | | | the string/unicode method .replace() with a zero-lengt first argument. Inyeol contributed tests for this too.
* 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.