test fix
This commit is contained in:
parent
cfdb264e6d
commit
842e15c4f0
2 changed files with 2 additions and 3 deletions
|
|
@ -83,13 +83,13 @@ class StringFormatterFilePathValidator(StringFormatterValidator):
|
|||
|
||||
def apply_formatter(self, variable_dict: Dict[str, str]) -> str:
|
||||
"""Turn into a Path, then a string, to get correct directory separators"""
|
||||
file_path = str(Path(super().apply_formatter(variable_dict)))
|
||||
file_path = Path(super().apply_formatter(variable_dict))
|
||||
file_directory, file_name = os.path.split(Path(file_path))
|
||||
|
||||
if self._is_file_name_too_long(file_name):
|
||||
return str(Path(file_directory) / self._truncate_file_name(file_name))
|
||||
|
||||
return file_path
|
||||
return str(file_path)
|
||||
|
||||
|
||||
class OverridesStringFormatterValidatorFilePathValidator(OverridesStringFormatterValidator):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class TestStringFormatterFilePathValidator:
|
|||
+ [f".en.{ext}" for ext in SUBTITLE_EXTENSIONS],
|
||||
)
|
||||
def test_truncates_file_name_successfully(self, ext: str):
|
||||
ext = ".info.json"
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
file_name = ("a" * 10000) + ext
|
||||
file_path = str(Path(temp_dir) / file_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue