[Python-Dev] SRE status report
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Fri, 30 Jun 2000 10:33:10 +0200
just checked in a test script for sre. the test_sre file is a
copy of test_re, with some minor changes:
-- disabled one test (caused by bug #8; see below)
-- added T (template mode, experimental, unsupported)
and U (unicode locale) flags to the flag test
-- removed keyword arguments in pattern test loop:
result =3D obj.search(s, pos=3Dresult.start(0), =
endpos=3Dresult.end(0)+1)
was changed to:
result =3D obj.search(s, result.start(0), result.end(0)+1)
as far as I can tell, the docs don't mention anything about keyword
arguments...
-- added unicode pattern / target string / locale tests to
the pattern test loop.
however, the current version SRE doesn't fully pass the test.
here's an annotated version of Lib/test/output/test_sre:
1) test_support -- test failed re module pickle
2) test_support -- test failed re module cPickle
under SRE, patterns are C objects, not class instances.
to allow pickling, I need to modify copy_reg (either by
modifing the file itself, or by updating the registry when
SRE is first imported). see patch #100650 for more info,
3) =3D=3D=3D Syntax error: ('(?P<foo_123>a)(?P=3Dfoo_123)', 'aa', 0, =
'g1', 'a')
this is a bug in the SRE parser. should be easy to fix.
4) =3D=3D=3D Failed incorrectly ('^(.+)?B', 'AB', 0, 'g1', 'A')
this is a bug in the engine (nested repetitions). needs
further research.
5) =3D=3D=3D Failed incorrectly ('(a+)+\\1', 'aa', 0, 'found+"-"+g1', =
'aa-a')
this is a bug in the engine or in the parser. needs further
research.
6) =3D=3D=3D grouping error ('([^/]*/)*sub1/', =
'd:msgs/tdir/sub1/trial/away.cpp', 0, 'found+"-"+g1', =
'd:msgs/tdir/sub1/-tdir/') 'd:msgs/tdir/sub1/-trial/' should be =
'd:msgs/tdir/sub1/-tdir/'
same as #5.
7) =3D=3D=3D Syntax error: ('(?P<id>aa)(?P=3Did)', 'aaaa', 0, =
'found+"-"+id', 'aaaa-aa')
same as #3.
8) =3D=3D=3D grouping error ('([abc])*bcd', 'abcd', 0, 'found+"-"+g1', =
'abcd-a') 'abcd-c' should be 'abcd-a'
this is a bug in the engine. should be easy to fix, I think.
in fact, I could have sworn that I'd fixed it already.
9) =3D=3D=3D grouping error ('(?i)([abc])*bcd', 'ABCD', 0, =
'found+"-"+g1', 'ABCD-A') 'ABCD-C' should be 'ABCD-A'
same as #8
10) =3D=3D=3D Syntax error: ('a(?!b).', 'abad', 0, 'found', 'ad')
this is bug in the parser. should be easy to fix.
11) =3D=3D=3D Syntax error: ('a(?=3Dd).', 'abad', 0, 'found', 'ad')
same as (or at least related to) #10
12) =3D=3D=3D Syntax error: ('a(?=3Dc|d).', 'abad', 0, 'found', 'ad')
same as #11
13) =3D=3D=3D Failed incorrectly ('^(.+)?B', 'AB', 0, 'g1', 'A')
same as #4 (literally!).
...
fwiw, *all* RE-based code I've played with seem to
work. ymmv. let me know asap if it does.
</F>