diff options
author | Joris | 2023-09-17 15:12:36 +0200 |
---|---|---|
committer | Joris | 2023-09-17 15:12:36 +0200 |
commit | f1eee98bb5144efc1aa242bad0e5676e12d882a5 (patch) | |
tree | 48374cac3a808fa9219c6338c8ac11d2a7f1935b /cli/new/test_format.py | |
parent | 61abb0a9a05bec2ce2ce58e2943eb1458b6b25c3 (diff) |
Test formatting
Diffstat (limited to 'cli/new/test_format.py')
-rw-r--r-- | cli/new/test_format.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/new/test_format.py b/cli/new/test_format.py new file mode 100644 index 0000000..d6269d0 --- /dev/null +++ b/cli/new/test_format.py @@ -0,0 +1,25 @@ +import cli.new.format as format + +def test_list(): + assert format.list([]) == '[]' + assert format.list(['a', 'b', 'c']) == '["a", "b", "c"]' + +def test_unaccent(): + assert format.unaccent('AuieTsrn') == 'AuieTsrn' + assert format.unaccent('âàéèêëîïôù') == 'aaeeeeiiou' + assert format.unaccent('ÂÀÉÈÊËÎÏÔÙ') == 'AAEEEEIIOU' + +def test_path_part(): + assert format.path_part('L’Homme à la béquille') == 'l-homme-a-la-bequille' + +def test_extension(): + assert format.extension('https://website.de/file.webp') == '.webp' + assert format.extension('/home/toto/extension-test/auie.notepad') == '.notepad' + +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”?' |