Commits

Thomas Lotze committed 957be91

don't let sentence-case break if the file name was sliced to an empty string

Comments (0)

Files changed (2)

tl/rename/case.py

 
 
 def sentence_case_path(path):
+    if not path:
+        # maybe slicing left nothing to transform; don't break in any case
+        return ''
+
     new_names = []
     while path:
         path, name = os.path.split(path)

tl/rename/case.txt

 >>> transform_sentence_case(['foo bar/baz asdf', '/foo/bar/baz asdf'])
 ['Foo bar/Baz asdf', '/Foo/Bar/Baz asdf']
 
+Make sure this works in combination with other options even if this means an
+empty piece of file name is to be sentence-cased:
+
+>>> transform_sentence_case([''])
+['']
+
 Exceptions
 ----------