Refactor test files for improved readability and consistency

- Removed unnecessary blank lines and adjusted formatting in test files.
- Ensured consistent use of commas in function calls and assertions across various test cases.
- Updated import statements for better organization and clarity.
- Enhanced mock setups in tests for better isolation and reliability.
- Improved assertions to follow a consistent style for better readability.
This commit is contained in:
JSC
2025-07-31 21:37:04 +02:00
parent e69098d633
commit 8847131f24
42 changed files with 602 additions and 616 deletions

View File

@@ -141,7 +141,7 @@ class SoundNormalizerService:
ffmpeg.run(stream, quiet=True, overwrite_output=True)
logger.info("One-pass normalization completed: %s", output_path)
except Exception as e:
except Exception:
logger.exception("One-pass normalization failed for %s", input_path)
raise
@@ -153,7 +153,7 @@ class SoundNormalizerService:
"""Normalize audio using two-pass loudnorm for better quality."""
try:
logger.info(
"Starting two-pass normalization: %s -> %s", input_path, output_path
"Starting two-pass normalization: %s -> %s", input_path, output_path,
)
# First pass: analyze
@@ -193,7 +193,7 @@ class SoundNormalizerService:
json_match = re.search(r'\{[^{}]*"input_i"[^{}]*\}', analysis_output)
if not json_match:
logger.error(
"Could not find JSON in loudnorm output: %s", analysis_output
"Could not find JSON in loudnorm output: %s", analysis_output,
)
raise ValueError("Could not extract loudnorm analysis data")
@@ -260,7 +260,7 @@ class SoundNormalizerService:
)
raise
except Exception as e:
except Exception:
logger.exception("Two-pass normalization failed for %s", input_path)
raise
@@ -428,7 +428,7 @@ class SoundNormalizerService:
"type": sound.type,
"is_normalized": sound.is_normalized,
"name": sound.name,
}
},
)
# Process each sound using captured data
@@ -476,7 +476,7 @@ class SoundNormalizerService:
"normalized_hash": None,
"id": sound_id,
"error": str(e),
}
},
)
logger.info("Normalization completed: %s", results)
@@ -517,7 +517,7 @@ class SoundNormalizerService:
"type": sound.type,
"is_normalized": sound.is_normalized,
"name": sound.name,
}
},
)
# Process each sound using captured data
@@ -565,7 +565,7 @@ class SoundNormalizerService:
"normalized_hash": None,
"id": sound_id,
"error": str(e),
}
},
)
logger.info("Type normalization completed: %s", results)