mirror of
https://github.com/fergalmoran/picard.git
synced 2025-12-25 10:48:18 +00:00
File renaming.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os.path
|
||||
import unittest
|
||||
from picard import util
|
||||
|
||||
@@ -55,3 +56,20 @@ class SanitizeDateTest(unittest.TestCase):
|
||||
self.failIfEqual(util.sanitize_date("2006--02"), "2006-02")
|
||||
self.failIfEqual(util.sanitize_date("2006.03.02"), "2006-03-02")
|
||||
|
||||
class ShortFilenameTest(unittest.TestCase):
|
||||
|
||||
def test_short(self):
|
||||
fn = util.make_short_filename("/home/me/", os.path.join("a1234567890", "b1234567890"), 255)
|
||||
self.failUnlessEqual(fn, os.path.join("a1234567890", "b1234567890"))
|
||||
|
||||
def test_long(self):
|
||||
fn = util.make_short_filename("/home/me/", os.path.join("a1234567890", "b1234567890"), 20)
|
||||
self.failUnlessEqual(fn, os.path.join("a123456", "b1"))
|
||||
|
||||
def test_long_2(self):
|
||||
fn = util.make_short_filename("/home/me/", os.path.join("a1234567890", "b1234567890"), 22)
|
||||
self.failUnlessEqual(fn, os.path.join("a12345678", "b1"))
|
||||
|
||||
def test_too_long(self):
|
||||
self.failUnlessRaises(IOError, util.make_short_filename, "/home/me/", os.path.join("a1234567890", "b1234567890"), 10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user