def test_update_offsets(self): lr = location_replace.LocationReplace() lr.offset_starter = 5 pattern = 'ABCD' text = 'The grey <a href="link">ABCD</a> jumped over the ABCD fence on a ABCD day' lr.update_offsets(pattern, text) self.assertEquals(lr.counter, 0) self.assertEqual(lr.offset_starter, 5) self.assertEqual(lr.offset_counters, [5, 6, 7]) self.assertEqual(lr.offsets.keys(), [5, 6, 7]) self.assertEqual(lr.offsets[5], (24, 28))
def test_update_offset_starter(self): lr = location_replace.LocationReplace() lr.offset_counters = [5, 6, 7] lr.update_offset_starter() self.assertEqual(lr.offset_starter, 8)