]> granicus.if.org Git - python/commitdiff
SF patch #682432, add lookbehind tests
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 13 Feb 2003 03:01:18 +0000 (03:01 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 13 Feb 2003 03:01:18 +0000 (03:01 +0000)
Lib/test/re_tests.py

index d6f04f058cebc8c086278eb04b65f0e461ff378f..7ab8eb9317c329d7b9b118f37e5bb1ba6132a600 100755 (executable)
@@ -548,6 +548,13 @@ tests = [
     ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', SUCCEED, 'g1 + g2', 'ce'),
     ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'),
 
+    # lookbehind: split by : but not if it is escaped by -.
+    ('(?<!-):(.*?)(?<!-):', 'a:bc-:de:f', SUCCEED, 'g1', 'bc-:de' ),
+    # escaping with \ as we know it
+    ('(?<!\\\):(.*?)(?<!\\\):', 'a:bc\\:de:f', SUCCEED, 'g1', 'bc\\:de' ),
+    # terminating with ' and escaping with ? as in edifact
+    ("(?<!\\?)'(.*?)(?<!\\?)'", "a'bc?'de'f", SUCCEED, 'g1', "bc?'de" ), 
+
     # Comments using the (?#...) syntax
 
     ('w(?# comment', 'w', SYNTAX_ERROR),