Fixed a couple of test failures on Windows.

This commit is contained in:
Karen Tracey 2012-09-09 15:07:04 -04:00
parent fcec904e4f
commit 2e92858386
1 changed files with 11 additions and 6 deletions

View File

@ -1,21 +1,26 @@
import os
from django.utils import unittest from django.utils import unittest
from django.utils._os import safe_join from django.utils._os import safe_join
class SafeJoinTests(unittest.TestCase): class SafeJoinTests(unittest.TestCase):
def test_base_path_ends_with_sep(self): def test_base_path_ends_with_sep(self):
drive, path = os.path.splitdrive(safe_join("/abc/", "abc"))
self.assertEqual( self.assertEqual(
safe_join("/abc/", "abc"), path,
"/abc/abc", "{0}abc{0}abc".format(os.path.sep)
) )
def test_root_path(self): def test_root_path(self):
drive, path = os.path.splitdrive(safe_join("/", "path"))
self.assertEqual( self.assertEqual(
safe_join("/", "path"), path,
"/path", "{0}path".format(os.path.sep),
) )
drive, path = os.path.splitdrive(safe_join("/", ""))
self.assertEqual( self.assertEqual(
safe_join("/", ""), path,
"/", os.path.sep,
) )