summaryrefslogtreecommitdiff
path: root/src/unitTests.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2015-03-25 11:13:26 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2015-03-25 11:13:26 +0000
commit70869715b99cdb0a24193e86f99bc954397bb509 (patch)
treed08fd649cd311bd9d5ad068574199e0c8fcb3782 /src/unitTests.py
parent540d2bc30990056245481426d8b00c5edc490f03 (diff)
downloadpyparsing-git-70869715b99cdb0a24193e86f99bc954397bb509.tar.gz
- update to srange to accept unicode literals in the input StringEnd
- enhanced version of replaceWith
Diffstat (limited to 'src/unitTests.py')
-rw-r--r--src/unitTests.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/unitTests.py b/src/unitTests.py
index cefd763..84fe9c9 100644
--- a/src/unitTests.py
+++ b/src/unitTests.py
@@ -854,6 +854,8 @@ class ReStringRangeTest(ParseTestCase):
(r"[A-]"),
(r"[-A]"),
(r"[\x21]"),
+ #(r"[а-яА-ЯёЁA-Z$_\041α-ω]".decode('utf-8')),
+ (u'[\u0430-\u044f\u0410-\u042f\u0451\u0401ABCDEFGHIJKLMNOPQRSTUVWXYZ$_\041\u03b1-\u03c9]'),
)
expectedResults = (
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
@@ -877,12 +879,13 @@ class ReStringRangeTest(ParseTestCase):
"A-",
"-A",
"!",
+ u"абвгдежзийклмнопрстуфхцчшщъыьэюяАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯёЁABCDEFGHIJKLMNOPQRSTUVWXYZ$_!αβγδεζηθικλμνξοπρςστυφχψω",
)
for test in zip( testCases, expectedResults ):
t,exp = test
res = pyparsing.srange(t)
- #~ print t,"->",res
- assert res == exp, "srange error, srange(%s)->'%r', expected '%r'" % (t, res, exp)
+ #print_(t,"->",res)
+ assert res == exp, "srange error, srange(%r)->'%r', expected '%r'" % (t, res, exp)
class SkipToParserTests(ParseTestCase):
def runTest(self):
@@ -1376,8 +1379,8 @@ class UpcaseDowncaseUnicode(ParseTestCase):
from __builtin__ import unichr
a = '\u00bfC\u00f3mo esta usted?'
- ualphas = "".join( [ unichr(i) for i in range(sys.maxunicode)
- if unichr(i).isalpha() ] )
+ ualphas = "".join( unichr(i) for i in range(sys.maxunicode)
+ if unichr(i).isalpha() )
uword = pp.Word(ualphas).setParseAction(pp.upcaseTokens)
print_ = lambda *args: None