aboutsummaryrefslogtreecommitdiff
path: root/tests/test_converter.py
blob: 1235dda29c51b243b0a50e3ea3c175084da1a32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Tests for the audiobook converter orchestration helpers."""

import unittest

from converter.converter import AudiobookConverter


class SanitizeFilenameTests(unittest.TestCase):
    def test_removes_invalid_characters(self):
        self.assertEqual(AudiobookConverter._sanitize_filename('A "bad" name: here'),
                         "A bad name here")

    def test_collapses_whitespace(self):
        self.assertEqual(AudiobookConverter._sanitize_filename("  spaced\tout  "), "spaced out")

    def test_empty_falls_back(self):
        self.assertEqual(AudiobookConverter._sanitize_filename("///"), "chapter")


if __name__ == "__main__":
    unittest.main()