aboutsummaryrefslogtreecommitdiff
path: root/src/test_str_format.py
blob: 94882175050f42a8b5e075fd416c3934280d4f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import src.str_format as format

def test_unaccent():
    assert format.unaccent('AuieTsrn') == 'AuieTsrn'
    assert format.unaccent('âàéèêëîïôù') == 'aaeeeeiiou'
    assert format.unaccent('ÂÀÉÈÊËÎÏÔÙ') == 'AAEEEEIIOU'

def test_path_part():
    assert format.safe_path('L’Homme à la béquille') == 'l-homme-a-la-bequille'

def test_cleaneup_quotes():
    assert format.cleanup_double_quotes('Bonjour, "ceci" où “cela”.', 'fr') == 'Bonjour, «ceci» où “cela”.'
    assert format.cleanup_double_quotes('Hello, "this" or «that».', 'en') == 'Hello, “this” or «that».'

def test_cleaneup_text():
    assert format.cleanup_text('l\'"est": ici... Là? OK! Yes !', 'fr') == '      l’« est » : ici… Là ? OK ! Yes !'
    assert format.cleanup_text('Is it "ok" or «not»?', 'en') == '      Is it “ok” or “not”?'

def test_cleanup_paragraphs():
    assert format.cleanup_paragraphs('  Foo\n\nBar\nBaz \n\n') == '      Foo\n\n      Bar\n\n      Baz'