update PathFormat class
- change 'has_extension' from a simple flag/bool to a field that contains the original filename extension - rename 'keywords' to 'kwdict' and some other stuff as well - inline 'adjust_path()' - put enumeration index before filename extension (#306)
This commit is contained in:
@@ -120,7 +120,7 @@ class TestDownloaderBase(unittest.TestCase):
|
||||
}
|
||||
pathfmt = PathFormat(cls.extractor)
|
||||
pathfmt.set_directory(kwdict)
|
||||
pathfmt.set_keywords(kwdict)
|
||||
pathfmt.set_filename(kwdict)
|
||||
|
||||
if content:
|
||||
mode = "w" + ("b" if isinstance(content, bytes) else "")
|
||||
@@ -145,7 +145,7 @@ class TestDownloaderBase(unittest.TestCase):
|
||||
|
||||
# test filename extension
|
||||
self.assertEqual(
|
||||
pathfmt.keywords["extension"],
|
||||
pathfmt.extension,
|
||||
expected_extension,
|
||||
)
|
||||
self.assertEqual(
|
||||
|
||||
@@ -218,8 +218,8 @@ class TestPathfmt():
|
||||
self.hashobj = hashobj
|
||||
self.path = ""
|
||||
self.size = 0
|
||||
self.keywords = {}
|
||||
self.has_extension = True
|
||||
self.kwdict = {}
|
||||
self.extension = "jpg"
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user