diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2012-09-17 20:00:14 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2012-09-17 20:00:14 +0100 |
| commit | 9313dea7006ab77d54735fdd5825a812684e7144 (patch) | |
| tree | 3c4e67806b8805e41889d8f078d7c0cb2030a85d /tests/regressiontests/utils | |
| parent | dbf8b93c527733fb5e3ea101a67bd94db745888e (diff) | |
| parent | d21f3d9b171a3cbff4c8ce7a9dbb8b8be3f21bac (diff) | |
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
django/db/backends/mysql/base.py
django/db/backends/postgresql_psycopg2/base.py
Diffstat (limited to 'tests/regressiontests/utils')
| -rw-r--r-- | tests/regressiontests/utils/os_utils.py | 26 | ||||
| -rw-r--r-- | tests/regressiontests/utils/tests.py | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/os_utils.py b/tests/regressiontests/utils/os_utils.py new file mode 100644 index 0000000000..a205d67431 --- /dev/null +++ b/tests/regressiontests/utils/os_utils.py @@ -0,0 +1,26 @@ +import os + +from django.utils import unittest +from django.utils._os import safe_join + + +class SafeJoinTests(unittest.TestCase): + def test_base_path_ends_with_sep(self): + drive, path = os.path.splitdrive(safe_join("/abc/", "abc")) + self.assertEqual( + path, + "{0}abc{0}abc".format(os.path.sep) + ) + + def test_root_path(self): + drive, path = os.path.splitdrive(safe_join("/", "path")) + self.assertEqual( + path, + "{0}path".format(os.path.sep), + ) + + drive, path = os.path.splitdrive(safe_join("/", "")) + self.assertEqual( + path, + os.path.sep, + ) diff --git a/tests/regressiontests/utils/tests.py b/tests/regressiontests/utils/tests.py index f4fa75b177..061c669eb7 100644 --- a/tests/regressiontests/utils/tests.py +++ b/tests/regressiontests/utils/tests.py @@ -21,6 +21,7 @@ from .http import TestUtilsHttp from .ipv6 import TestUtilsIPv6 from .jslex import JsToCForGettextTest, JsTokensTest from .module_loading import CustomLoader, DefaultLoader, EggLoader +from .os_utils import SafeJoinTests from .regex_helper import NormalizeTests from .simplelazyobject import TestUtilsSimpleLazyObject from .termcolors import TermColorTests |
