small fixes and some comments

This commit is contained in:
Ionuț Ciocîrlan
2013-06-14 21:18:25 +03:00
parent 9a8bb4ef94
commit 1b695eea63
2 changed files with 42 additions and 35 deletions

View File

@@ -84,15 +84,15 @@ class ShortFilenameTest(unittest.TestCase):
self.assertEqual(fn, os.path.join(self.root, *[u"\U00010916" * (255/4)] * 2))
def test_windows_shortening(self):
fn = util.make_short_filename(self.root, os.path.join("a" * 200, "b" * 200, "c" * 200), win_compat=True)
self.assertEqual(fn, os.path.join(self.root, "a" * 116, "b" * 116, "c" * 11))
fn = util.make_short_filename(self.root, os.path.join("a" * 200, "b" * 200, "c" * 200 + ".ext"), win_compat=True)
self.assertEqual(fn, os.path.join(self.root, "a" * 116, "b" * 116, "c" * 7 + ".ext"))
@unittest.skipUnless(sys.platform != "win32", "non-windows test")
def test_windows_shortening_with_ancestor_on_nix(self):
fn = util.make_short_filename(
os.path.join(self.root, "w" * 10, "x" * 10, "y" * 9, "z" * 9), os.path.join("b" * 200, "c" * 200, "d" * 200),
os.path.join(self.root, "w" * 10, "x" * 10, "y" * 9, "z" * 9), os.path.join("b" * 200, "c" * 200, "d" * 200 + ".ext"),
win_compat=True, relative_to = self.root)
self.assertEqual(fn, os.path.join(self.root, "w" * 10, "x" * 10, "y" * 9, "z" * 9, "b" * 100, "c" * 100, "d" * 11))
self.assertEqual(fn, os.path.join(self.root, "w" * 10, "x" * 10, "y" * 9, "z" * 9, "b" * 100, "c" * 100, "d" * 7 + ".ext"))
def test_windows_selective_shortening(self):
root = self.root + "x" * (44 - 10 - 3)