You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
631 B
16 lines
631 B
from unittest import TestCase |
|
|
|
from voice_transcriptor.formatting import format_duration, format_file_size |
|
|
|
|
|
class FormattingTests(TestCase): |
|
def test_formats_binary_file_sizes(self) -> None: |
|
self.assertEqual(format_file_size(0), "0 B") |
|
self.assertEqual(format_file_size(1536), "1.50 KiB") |
|
self.assertEqual(format_file_size(2 * 1024**3), "2.00 GiB") |
|
|
|
def test_formats_multi_hour_duration(self) -> None: |
|
self.assertEqual(format_duration(3 * 3600 + 5 * 60 + 9.8), "03:05:10") |
|
|
|
def test_formats_unavailable_duration(self) -> None: |
|
self.assertEqual(format_duration(None), "Unknown")
|
|
|