Le vendredi 01 juillet 2011 à 17:54 +0200, r.david.murray a écrit : > http://hg.python.org/cpython/rev/f8ece8c93918 > changeset: 71119:f8ece8c93918 > branch: 3.2 > parent: 71117:3f30cfe51315 > user: R David Murray <rdmur...@bitdance.com> > date: Fri Jul 01 11:51:50 2011 -0400 > summary: > #11873: fix test regex so it covers windows os.sep as well. > > files: > Lib/test/test_compileall.py | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py > --- a/Lib/test/test_compileall.py > +++ b/Lib/test/test_compileall.py > @@ -248,7 +248,7 @@ > self.assertEqual(b'', quiet) > > def test_regexp(self): > - self.assertRunOK('-q', '-x', 'ba[^\/]*$', self.pkgdir) > + self.assertRunOK('-q', '-x', r'ba[^\/]*$', self.pkgdir) > self.assertNotCompiled(self.barfn) > self.assertCompiled(self.initfn)
I'm not sure that your regex is correct. You may have to use a double slash or it is interpreted by the regex :-/ >>> import re >>> re.match(r'ba[^\/]*$', 'babar') <_sre.SRE_Match object at 0x7f420559a7e8> >>> re.match(r'ba[^\/]*$', 'babar/') >>> re.match(r'ba[^\/]*$', 'babar\\a') <_sre.SRE_Match object at 0x7f420559a850> Correct regex: >>> re.match(r'ba[^\\/]*$', 'baba\\') >>> re.match(r'ba[^\\/]*$', 'baba/') Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com