def test_convert(): wl = WikiList(':*A1\n' ':*#B1\n' ':*#B2\n' ':*:continuing A1\n' ':*A2', pattern=r':\*') assert wl.level == 2 wl.convert('#') assert wl.string == ('#A1\n' '##B1\n' '##B2\n' '#:continuing A1\n' '#A2') assert wl.pattern == r'\#' assert wl.level == 1
def test_convert(self): ae = self.assertEqual wl = WikiList(':*A1\n' ':*#B1\n' ':*#B2\n' ':*:continuing A1\n' ':*A2', pattern=r':\*') ae(wl.level, 2) wl.convert('#') ae(wl.string, '#A1\n' '##B1\n' '##B2\n' '#:continuing A1\n' '#A2') ae(wl.pattern, r'\#') ae(wl.level, 1)