def test_interpunction_single_line(self, sign): inp = 'Aa{sign} Bb{sign} aa{sign}'.format(sign=sign) exp = { '': { 'aa': 1 }, 'aa': { sign: 2 }, sign: { 'bb': 1, 'aa': 1 }, 'bb': { sign: 1 }, } assert build_dict([inp])[0] == exp
def test_caps(self): inp = ['Hello John McClane.'] caps = build_dict(inp)[1] assert 'hello' not in caps assert caps['john'] == 'John' assert caps['mcclane'] == 'McClane'
def test_lines_with_new_paragraphs(self, inp, exp): assert build_dict(inp)[0] == exp
def test_multiple_empty_lines(self): d = build_dict(['', ' ', ''])[0] assert d[''] == {}
def test_hyphen_single_line(self, inp, exp): assert build_dict([inp])[0] == exp