def _test_mark(self): # XXX need to rewrite this implementation-independent opcodes = s.encode_literal("a") + [s.OPCODES["mark"], 0] \ + s.encode_literal("b") + [s.OPCODES["mark"], 1, s.OPCODES["success"]] state = self.create_state("abc") _sre._sre_search(state, opcodes) assert 1 == state.lastindex assert 1 == state.lastmark # NB: the following are indexes from the start of the match assert [1, 2] == state.marks
def _test_mark(self): # XXX need to rewrite this implementation-independent opcodes = self.encode_literal("a") + [OPCODES["mark"], 0] \ + self.encode_literal("b") + [OPCODES["mark"], 1, OPCODES["success"]] state = self.create_state("abc") _sre._sre_search(state, opcodes) self.assertEquals(1, state.lastindex) self.assertEquals(1, state.lastmark) # NB: the following are indexes from the start of the match self.assertEquals([1, 2], state.marks)