def test_pattern_regexp(self): lines = ['abx-something--rrr'] self.assertEqual(['abx', 'something', 'rrr'], next(records(lines, pattern=re.compile('[a-z]+')))[:])
def test_pattern(self): lines = ['abx-something--rrr'] self.assertEqual(['abx', 'something', 'rrr'], next(records(lines, pattern='[a-z]+'))[:])
def test_widths_with_tail(self): lines = ['abx-something--rrr'] self.assertEqual(['abx', '-somet', 'hing--', 'rrr'], next(records(lines, widths=[3, 6, 6, ...]))[:])
def test_regexp(self): lines = ['abx-something--rrr'] self.assertEqual(['abx', 'something', 'rrr'], next(records(lines, separator=re.compile('-+')))[:])
def test_separator(self): lines = ['abx-something--rrr'] self.assertEqual(['abx', 'something', '', 'rrr'], next(records(lines, separator='-'))[:])
def test_blank(self): lines = ['abc def jkzzz'] self.assertEqual(['abc', 'def', 'jkzzz'], next(records(lines))[:])