11import pytest
2- import sys
3- import os
42import argparse
53from unittest import mock
64from any_to_any import AnyToAny
7- from modules .category import Category
8- import types
95
106@pytest .fixture
117def instance ():
128 return AnyToAny ()
139
1410def test_routing_supported_formats (instance ):
15- """
16- Ensure all supported formats are routed to the correct handler or codec.
17- """
11+ # Ensure all supported formats are routed to the correct handler or codec.
1812 for cat , formats in instance ._supported_formats .items ():
1913 for fmt , handler in formats .items ():
2014 if callable (handler ):
@@ -27,28 +21,22 @@ def test_routing_supported_formats(instance):
2721 assert isinstance (handler , (str , list ))
2822
2923def test_run_web_flag_starts_web ():
30- """
31- Test that the CLI parser recognizes the -w/--web flag.
32- """
24+ # Test that the CLI parser recognizes the -w/--web flag.
3325 parser = argparse .ArgumentParser ()
3426 parser .add_argument ('-w' , '--web' , action = 'store_true' )
3527 args = parser .parse_args (['-w' ])
3628 assert args .web
3729
3830
3931def test_end_with_msg_logs_and_exits (instance , caplog ):
40- """
41- Test _end_with_msg logs error and raises SystemExit.
42- """
32+ # Test _end_with_msg logs error and raises SystemExit.
4333 with caplog .at_level ('WARNING' ):
4434 with pytest .raises (SystemExit ):
4535 instance ._end_with_msg (SystemExit , 'fail message' )
4636 assert 'fail message' in caplog .text
4737
4838def test_recursive_file_discovery (instance , tmp_path ):
49- """
50- _get_file_paths does not recurse; only top-level files are found.
51- """
39+ # _get_file_paths does not recurse; only top-level files are found.
5240 d1 = tmp_path / "a"
5341 d2 = d1 / "b"
5442 d2 .mkdir (parents = True )
@@ -60,13 +48,11 @@ def test_recursive_file_discovery(instance, tmp_path):
6048 str (f .parent ) in path [0 ] and path [1 ] == 'test' and path [2 ] == 'mp4'
6149 for paths in file_paths .values () for path in paths
6250 )
63- assert not found # Documented limitation
51+ assert not found # Documented limitation, this is intentional
6452
6553
6654def test_weird_filenames (instance , tmp_path ):
67- """
68- Test handling of files with unicode and special chars in names.
69- """
55+ # Test handling of files with unicode and special chars in names.
7056 fname = "weird_名字_#@!.mp3"
7157 f = tmp_path / fname
7258 f .write_bytes (b"\x00 " * 128 )
@@ -75,9 +61,7 @@ def test_weird_filenames(instance, tmp_path):
7561 assert found
7662
7763def test_post_process_permission_error (instance , tmp_path ):
78- """
79- Test _post_process logs and raises on permission error during delete.
80- """
64+ # Test _post_process logs and raises on permission error during delete.
8165 f = tmp_path / "test.mp4"
8266 f .write_bytes (b"\x00 " * 128 )
8367 with mock .patch ("os.remove" , side_effect = PermissionError ):
0 commit comments