mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
fix at_beginning
This commit is contained in:
@@ -88,8 +88,6 @@ class ReTests(unittest.TestCase):
|
||||
int_value = int(matchobj.group(0))
|
||||
return str(int_value + 1)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
# @unittest.expectedFailure
|
||||
def test_basic_re_sub(self):
|
||||
self.assertTypedEqual(re.sub('y', 'a', 'xyz'), 'xaz')
|
||||
self.assertTypedEqual(re.sub('y', S('a'), S('xyz')), 'xaz')
|
||||
@@ -1661,8 +1659,6 @@ class ReTests(unittest.TestCase):
|
||||
self.checkPatternError(r'(?i+', 'missing -, : or )', 3)
|
||||
self.checkPatternError(r'(?iz', 'unknown flag', 3)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_bug_6509(self):
|
||||
# Replacement strings of both types must parse properly.
|
||||
# all strings
|
||||
|
||||
@@ -59,4 +59,6 @@ assert re.compile('(a)(bc)').match('abc')[1] == 'a'
|
||||
assert re.compile('a(b)(?P<a>c)d').match('abcd').groupdict() == {'a': 'c'}
|
||||
|
||||
# test op branch
|
||||
assert re.compile(r'((?=\d|\.\d)(?P<int>\d*)|a)', re.DEBUG).match('123.2132').group() == '123'
|
||||
assert re.compile(r'((?=\d|\.\d)(?P<int>\d*)|a)').match('123.2132').group() == '123'
|
||||
|
||||
assert re.sub(r'^\s*', 'X', 'test') == 'Xtest'
|
||||
@@ -274,7 +274,8 @@ trait MatchContextDrive {
|
||||
self.state().pattern_codes.len() - self.ctx().code_position
|
||||
}
|
||||
fn at_beginning(&self) -> bool {
|
||||
self.ctx().string_position == self.state().start
|
||||
// self.ctx().string_position == self.state().start
|
||||
self.ctx().string_position == 0
|
||||
}
|
||||
fn at_end(&self) -> bool {
|
||||
self.ctx().string_position == self.state().end
|
||||
|
||||
Reference in New Issue
Block a user