[pypy-svn] r77751 - in pypy/branch/fast-forward/pypy/rlib/rsre: . test

afa at codespeak.net afa at codespeak.net
Sun Oct 10 01:56:18 CEST 2010


Author: afa
Date: Sun Oct 10 01:56:16 2010
New Revision: 77751

Modified:
   pypy/branch/fast-forward/pypy/rlib/rsre/rsre_char.py
   pypy/branch/fast-forward/pypy/rlib/rsre/test/test_char.py
Log:
CPython issue6561: fix characters matched by regexp r'\d'


Modified: pypy/branch/fast-forward/pypy/rlib/rsre/rsre_char.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/rsre/rsre_char.py	(original)
+++ pypy/branch/fast-forward/pypy/rlib/rsre/rsre_char.py	Sun Oct 10 01:56:16 2010
@@ -80,7 +80,7 @@
 
 def is_uni_digit(code):
     assert unicodedb is not None
-    return unicodedb.isdigit(code)
+    return unicodedb.isdecimal(code)
 
 def is_space(code):
     return code < 128 and (ascii_char_info[code] & 2 != 0)

Modified: pypy/branch/fast-forward/pypy/rlib/rsre/test/test_char.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/rsre/test/test_char.py	(original)
+++ pypy/branch/fast-forward/pypy/rlib/rsre/test/test_char.py	Sun Oct 10 01:56:16 2010
@@ -8,10 +8,13 @@
 UPPER_PI = 0x3a0
 LOWER_PI = 0x3c0
 INDIAN_DIGIT = 0x966
+ROMAN_NUMERAL = 0x2165
+FULLWIDTH_DIGIT = 0xff10
+CIRCLED_NUMBER = 0x32b4
+DINGBAT_CIRCLED = 0x2781
 EM_SPACE = 0x2001
 LINE_SEP = 0x2028
 
-
 # XXX very incomplete test
 
 def test_getlower():
@@ -105,3 +108,15 @@
     assert     cat(CHCODES["category_uni_not_linebreak"], ord(' '))
     assert     cat(CHCODES["category_uni_not_linebreak"], ord('s'))
     assert not cat(CHCODES["category_uni_not_linebreak"], LINE_SEP)
+    #
+    assert     cat(CHCODES["category_uni_digit"], INDIAN_DIGIT)
+    assert     cat(CHCODES["category_uni_digit"], FULLWIDTH_DIGIT)
+    assert not cat(CHCODES["category_uni_digit"], ROMAN_NUMERAL)
+    assert not cat(CHCODES["category_uni_digit"], CIRCLED_NUMBER)
+    assert not cat(CHCODES["category_uni_digit"], DINGBAT_CIRCLED)
+    #
+    assert not cat(CHCODES["category_uni_not_digit"], INDIAN_DIGIT)
+    assert not cat(CHCODES["category_uni_not_digit"], FULLWIDTH_DIGIT)
+    assert     cat(CHCODES["category_uni_not_digit"], ROMAN_NUMERAL)
+    assert     cat(CHCODES["category_uni_not_digit"], CIRCLED_NUMBER)
+    assert     cat(CHCODES["category_uni_not_digit"], DINGBAT_CIRCLED)



More information about the Pypy-commit mailing list