Skip to content

Commit 7a89322

Browse files
committed
add tests
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
1 parent 5d1149a commit 7a89322

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_re.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,6 +2712,18 @@ def test_search_anchor_at_beginning(self):
27122712
# With optimization -- 0.0003 seconds.
27132713
self.assertLess(stopwatch.seconds, 0.1)
27142714

2715+
def test_search_anchor_at_beginning_line(self):
2716+
# Test "^" anchor with UCS-1, UCS-2 and UCS-4 characters.
2717+
p = re.compile('^a', re.MULTILINE)
2718+
self.assertEqual([m.span() for m in p.finditer('a\n\xe0a\na')], [(0, 1), (5, 6)])
2719+
self.assertEqual([m.span() for m in p.finditer('a\n\u0430a\na')], [(0, 1), (5, 6)])
2720+
self.assertEqual([m.span() for m in p.finditer('a\n\U0001d49ca\na')], [(0, 1), (5, 6)])
2721+
2722+
def test_search_anchor_at_beginning_line_at_end(self):
2723+
# "^" matches the end of the string if the string ends with a newline.
2724+
p = re.compile('^', re.MULTILINE)
2725+
self.assertEqual([m.span() for m in p.finditer('a\n')], [(0, 0), (2, 2)])
2726+
27152727
def test_possessive_quantifiers(self):
27162728
"""Test Possessive Quantifiers
27172729
Test quantifiers of the form @+ for some repetition operator @,

0 commit comments

Comments
 (0)