diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2000-09-02 16:36:57 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2000-09-02 16:36:57 (GMT) |
commit | 510c97ba2f573bb5336681126ea6aad45a928a52 (patch) | |
tree | aae70f97d65707e07fa04440e94044a7c3f950c6 /Lib/test/test_sre.py | |
parent | ff07f8c7eaab3f0000c30921545c01429977aeff (diff) | |
download | cpython-510c97ba2f573bb5336681126ea6aad45a928a52.zip cpython-510c97ba2f573bb5336681126ea6aad45a928a52.tar.gz cpython-510c97ba2f573bb5336681126ea6aad45a928a52.tar.bz2 |
return -1 for undefined groups (as implemented in 1.5.2) instead of
None (as documented) from start/end/span. closes bug #113254
Diffstat (limited to 'Lib/test/test_sre.py')
-rw-r--r-- | Lib/test/test_sre.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py index 3d8926f..1eea12f 100644 --- a/Lib/test/test_sre.py +++ b/Lib/test/test_sre.py @@ -46,7 +46,7 @@ def test(expression, result, exception=None): if verbose: print 'Running tests on character literals' -for i in range(0, 256): +for i in [0, 8, 16, 32, 64, 127, 128, 255]: test(r"""sre.match("\%03o" % i, chr(i)) != None""", 1) test(r"""sre.match("\%03o0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match("\%03o8" % i, chr(i)+"8") != None""", 1) @@ -73,6 +73,11 @@ test(r"""sre.match('x*', 'xxxa').span(0)""", (0, 3)) test(r"""sre.match('x*', 'xxxa').span()""", (0, 3)) test(r"""sre.match('a+', 'xxx')""", None) +# bug 113254 +test(r"""sre.match('(a)|(b)', 'b').start(1)""", -1) +test(r"""sre.match('(a)|(b)', 'b').end(1)""", -1) +test(r"""sre.match('(a)|(b)', 'b').span(1)""", (-1, -1)) + if verbose: print 'Running tests on sre.sub' |