Back to index

python3.2  3.2.2
Public Member Functions | Static Private Member Functions
test.test_posixpath.PosixPathTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_join
def test_split
def splitextTest
def test_splitext
def test_isabs
def test_basename
def test_dirname
def test_islink
def test_samefile
def test_samefile_on_links
def test_samestat
def test_samestat_on_links
def test_ismount
def test_ismount_non_existent
def test_ismount_symlinks
def test_ismount_different_device
def test_expanduser
def test_normpath
def test_realpath_basic
def test_realpath_relative
def test_realpath_symlink_loops
def test_realpath_resolve_parents
def test_realpath_resolve_before_normalizing
def test_realpath_resolve_first
def test_relpath
def test_relpath_bytes
def test_sameopenfile

Static Private Member Functions

def _create_file

Detailed Description

Definition at line 35 of file test_posixpath.py.


Member Function Documentation

def test.test_posixpath.PosixPathTest._create_file (   filename) [static, private]

Definition at line 176 of file test_posixpath.py.

00176 
00177     def _create_file(filename):
00178         with open(filename, 'wb') as f:
00179             f.write(b'foo')

Here is the caller graph for this function:

Definition at line 37 of file test_posixpath.py.

00037 
00038     def setUp(self):
00039         self.tearDown()

Here is the caller graph for this function:

def test.test_posixpath.PosixPathTest.splitextTest (   self,
  path,
  filename,
  ext 
)

Definition at line 75 of file test_posixpath.py.

00075 
00076     def splitextTest(self, path, filename, ext):
00077         self.assertEqual(posixpath.splitext(path), (filename, ext))
00078         self.assertEqual(posixpath.splitext("/" + path), ("/" + filename, ext))
00079         self.assertEqual(posixpath.splitext("abc/" + path),
00080                          ("abc/" + filename, ext))
00081         self.assertEqual(posixpath.splitext("abc.def/" + path),
00082                          ("abc.def/" + filename, ext))
00083         self.assertEqual(posixpath.splitext("/abc.def/" + path),
00084                          ("/abc.def/" + filename, ext))
00085         self.assertEqual(posixpath.splitext(path + "/"),
00086                          (filename + ext + "/", ""))
00087 
00088         path = bytes(path, "ASCII")
00089         filename = bytes(filename, "ASCII")
00090         ext = bytes(ext, "ASCII")
00091 
00092         self.assertEqual(posixpath.splitext(path), (filename, ext))
00093         self.assertEqual(posixpath.splitext(b"/" + path),
00094                          (b"/" + filename, ext))
00095         self.assertEqual(posixpath.splitext(b"abc/" + path),
00096                          (b"abc/" + filename, ext))
00097         self.assertEqual(posixpath.splitext(b"abc.def/" + path),
00098                          (b"abc.def/" + filename, ext))
00099         self.assertEqual(posixpath.splitext(b"/abc.def/" + path),
00100                          (b"/abc.def/" + filename, ext))
00101         self.assertEqual(posixpath.splitext(path + b"/"),
00102                          (filename + ext + b"/", b""))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 40 of file test_posixpath.py.

00040 
00041     def tearDown(self):
00042         for suffix in ["", "1", "2"]:
00043             support.unlink(support.TESTFN + suffix)
00044             safe_rmdir(support.TESTFN + suffix)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file test_posixpath.py.

00130 
00131     def test_basename(self):
00132         self.assertEqual(posixpath.basename("/foo/bar"), "bar")
00133         self.assertEqual(posixpath.basename("/"), "")
00134         self.assertEqual(posixpath.basename("foo"), "foo")
00135         self.assertEqual(posixpath.basename("////foo"), "foo")
00136         self.assertEqual(posixpath.basename("//foo//bar"), "bar")
00137 
00138         self.assertEqual(posixpath.basename(b"/foo/bar"), b"bar")
00139         self.assertEqual(posixpath.basename(b"/"), b"")
00140         self.assertEqual(posixpath.basename(b"foo"), b"foo")
00141         self.assertEqual(posixpath.basename(b"////foo"), b"foo")
00142         self.assertEqual(posixpath.basename(b"//foo//bar"), b"bar")

Here is the call graph for this function:

Definition at line 143 of file test_posixpath.py.

00143 
00144     def test_dirname(self):
00145         self.assertEqual(posixpath.dirname("/foo/bar"), "/foo")
00146         self.assertEqual(posixpath.dirname("/"), "/")
00147         self.assertEqual(posixpath.dirname("foo"), "")
00148         self.assertEqual(posixpath.dirname("////foo"), "////")
00149         self.assertEqual(posixpath.dirname("//foo//bar"), "//foo")
00150 
00151         self.assertEqual(posixpath.dirname(b"/foo/bar"), b"/foo")
00152         self.assertEqual(posixpath.dirname(b"/"), b"/")
00153         self.assertEqual(posixpath.dirname(b"foo"), b"")
00154         self.assertEqual(posixpath.dirname(b"////foo"), b"////")
00155         self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")

Here is the call graph for this function:

Definition at line 273 of file test_posixpath.py.

00273 
00274     def test_expanduser(self):
00275         self.assertEqual(posixpath.expanduser("foo"), "foo")
00276         self.assertEqual(posixpath.expanduser(b"foo"), b"foo")
00277         try:
00278             import pwd
00279         except ImportError:
00280             pass
00281         else:
00282             self.assertIsInstance(posixpath.expanduser("~/"), str)
00283             self.assertIsInstance(posixpath.expanduser(b"~/"), bytes)
00284             # if home directory == root directory, this test makes no sense
00285             if posixpath.expanduser("~") != '/':
00286                 self.assertEqual(
00287                     posixpath.expanduser("~") + "/",
00288                     posixpath.expanduser("~/")
00289                 )
00290                 self.assertEqual(
00291                     posixpath.expanduser(b"~") + b"/",
00292                     posixpath.expanduser(b"~/")
00293                 )
00294             self.assertIsInstance(posixpath.expanduser("~root/"), str)
00295             self.assertIsInstance(posixpath.expanduser("~foo/"), str)
00296             self.assertIsInstance(posixpath.expanduser(b"~root/"), bytes)
00297             self.assertIsInstance(posixpath.expanduser(b"~foo/"), bytes)
00298 
00299             with support.EnvironmentVarGuard() as env:
00300                 env['HOME'] = '/'
00301                 self.assertEqual(posixpath.expanduser("~"), "/")
00302                 # expanduser should fall back to using the password database
00303                 del env['HOME']
00304                 home = pwd.getpwuid(os.getuid()).pw_dir
00305                 self.assertEqual(posixpath.expanduser("~"), home)

Here is the call graph for this function:

Definition at line 117 of file test_posixpath.py.

00117 
00118     def test_isabs(self):
00119         self.assertIs(posixpath.isabs(""), False)
00120         self.assertIs(posixpath.isabs("/"), True)
00121         self.assertIs(posixpath.isabs("/foo"), True)
00122         self.assertIs(posixpath.isabs("/foo/bar"), True)
00123         self.assertIs(posixpath.isabs("foo/bar"), False)
00124 
00125         self.assertIs(posixpath.isabs(b""), False)
00126         self.assertIs(posixpath.isabs(b"/"), True)
00127         self.assertIs(posixpath.isabs(b"/foo"), True)
00128         self.assertIs(posixpath.isabs(b"/foo/bar"), True)
00129         self.assertIs(posixpath.isabs(b"foo/bar"), False)

Here is the call graph for this function:

Definition at line 156 of file test_posixpath.py.

00156 
00157     def test_islink(self):
00158         self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
00159         self.assertIs(posixpath.lexists(support.TESTFN + "2"), False)
00160         f = open(support.TESTFN + "1", "wb")
00161         try:
00162             f.write(b"foo")
00163             f.close()
00164             self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
00165             if support.can_symlink():
00166                 os.symlink(support.TESTFN + "1", support.TESTFN + "2")
00167                 self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
00168                 os.remove(support.TESTFN + "1")
00169                 self.assertIs(posixpath.islink(support.TESTFN + "2"), True)
00170                 self.assertIs(posixpath.exists(support.TESTFN + "2"), False)
00171                 self.assertIs(posixpath.lexists(support.TESTFN + "2"), True)
00172         finally:
00173             if not f.close():
00174                 f.close()

Here is the call graph for this function:

Definition at line 232 of file test_posixpath.py.

00232 
00233     def test_ismount(self):
00234         self.assertIs(posixpath.ismount("/"), True)
00235         self.assertIs(posixpath.ismount(b"/"), True)

Here is the call graph for this function:

Definition at line 256 of file test_posixpath.py.

00256 
00257     def test_ismount_different_device(self):
00258         # Simulate the path being on a different device from its parent by
00259         # mocking out st_dev.
00260         save_lstat = os.lstat
00261         def fake_lstat(path):
00262             st_ino = 0
00263             st_dev = 0
00264             if path == ABSTFN:
00265                 st_dev = 1
00266                 st_ino = 1
00267             return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
00268         try:
00269             os.lstat = fake_lstat
00270             self.assertIs(posixpath.ismount(ABSTFN), True)
00271         finally:
00272             os.lstat = save_lstat

Here is the call graph for this function:

Definition at line 236 of file test_posixpath.py.

00236 
00237     def test_ismount_non_existent(self):
00238         # Non-existent mountpoint.
00239         self.assertIs(posixpath.ismount(ABSTFN), False)
00240         try:
00241             os.mkdir(ABSTFN)
00242             self.assertIs(posixpath.ismount(ABSTFN), False)
00243         finally:
00244             safe_rmdir(ABSTFN)

Here is the call graph for this function:

Definition at line 247 of file test_posixpath.py.

00247 
00248     def test_ismount_symlinks(self):
00249         # Symlinks are never mountpoints.
00250         try:
00251             os.symlink("/", ABSTFN)
00252             self.assertIs(posixpath.ismount(ABSTFN), False)
00253         finally:
00254             os.unlink(ABSTFN)

Here is the call graph for this function:

Definition at line 45 of file test_posixpath.py.

00045 
00046     def test_join(self):
00047         self.assertEqual(posixpath.join("/foo", "bar", "/bar", "baz"),
00048                          "/bar/baz")
00049         self.assertEqual(posixpath.join("/foo", "bar", "baz"), "/foo/bar/baz")
00050         self.assertEqual(posixpath.join("/foo/", "bar/", "baz/"),
00051                          "/foo/bar/baz/")
00052 
00053         self.assertEqual(posixpath.join(b"/foo", b"bar", b"/bar", b"baz"),
00054                          b"/bar/baz")
00055         self.assertEqual(posixpath.join(b"/foo", b"bar", b"baz"),
00056                          b"/foo/bar/baz")
00057         self.assertEqual(posixpath.join(b"/foo/", b"bar/", b"baz/"),
00058                          b"/foo/bar/baz/")
00059 
00060         self.assertRaises(TypeError, posixpath.join, b"bytes", "str")
00061         self.assertRaises(TypeError, posixpath.join, "str", b"bytes")

Here is the call graph for this function:

Definition at line 306 of file test_posixpath.py.

00306 
00307     def test_normpath(self):
00308         self.assertEqual(posixpath.normpath(""), ".")
00309         self.assertEqual(posixpath.normpath("/"), "/")
00310         self.assertEqual(posixpath.normpath("//"), "//")
00311         self.assertEqual(posixpath.normpath("///"), "/")
00312         self.assertEqual(posixpath.normpath("///foo/.//bar//"), "/foo/bar")
00313         self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"),
00314                          "/foo/baz")
00315         self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar")
00316 
00317         self.assertEqual(posixpath.normpath(b""), b".")
00318         self.assertEqual(posixpath.normpath(b"/"), b"/")
00319         self.assertEqual(posixpath.normpath(b"//"), b"//")
00320         self.assertEqual(posixpath.normpath(b"///"), b"/")
00321         self.assertEqual(posixpath.normpath(b"///foo/.//bar//"), b"/foo/bar")
00322         self.assertEqual(posixpath.normpath(b"///foo/.//bar//.//..//.//baz"),
00323                          b"/foo/baz")
00324         self.assertEqual(posixpath.normpath(b"///..//./foo/.//bar"),
00325                          b"/foo/bar")

Here is the call graph for this function:

Definition at line 329 of file test_posixpath.py.

00329 
00330     def test_realpath_basic(self):
00331         # Basic operation.
00332         try:
00333             os.symlink(ABSTFN+"1", ABSTFN)
00334             self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
00335         finally:
00336             support.unlink(ABSTFN)

Here is the call graph for this function:

Definition at line 340 of file test_posixpath.py.

00340 
00341     def test_realpath_relative(self):
00342         try:
00343             os.symlink(posixpath.relpath(ABSTFN+"1"), ABSTFN)
00344             self.assertEqual(realpath(ABSTFN), ABSTFN+"1")
00345         finally:
00346             support.unlink(ABSTFN)

Here is the call graph for this function:

Definition at line 397 of file test_posixpath.py.

00397 
00398     def test_realpath_resolve_before_normalizing(self):
00399         # Bug #990669: Symbolic links should be resolved before we
00400         # normalize the path. E.g.: if we have directories 'a', 'k' and 'y'
00401         # in the following hierarchy:
00402         # a/k/y
00403         #
00404         # and a symbolic link 'link-y' pointing to 'y' in directory 'a',
00405         # then realpath("link-y/..") should return 'k', not 'a'.
00406         try:
00407             old_path = abspath('.')
00408             os.mkdir(ABSTFN)
00409             os.mkdir(ABSTFN + "/k")
00410             os.mkdir(ABSTFN + "/k/y")
00411             os.symlink(ABSTFN + "/k/y", ABSTFN + "/link-y")
00412 
00413             # Absolute path.
00414             self.assertEqual(realpath(ABSTFN + "/link-y/.."), ABSTFN + "/k")
00415             # Relative path.
00416             os.chdir(dirname(ABSTFN))
00417             self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."),
00418                              ABSTFN + "/k")
00419         finally:
00420             os.chdir(old_path)
00421             support.unlink(ABSTFN + "/link-y")
00422             safe_rmdir(ABSTFN + "/k/y")
00423             safe_rmdir(ABSTFN + "/k")
00424             safe_rmdir(ABSTFN)

Here is the call graph for this function:

Definition at line 428 of file test_posixpath.py.

00428 
00429     def test_realpath_resolve_first(self):
00430         # Bug #1213894: The first component of the path, if not absolute,
00431         # must be resolved too.
00432 
00433         try:
00434             old_path = abspath('.')
00435             os.mkdir(ABSTFN)
00436             os.mkdir(ABSTFN + "/k")
00437             os.symlink(ABSTFN, ABSTFN + "link")
00438             os.chdir(dirname(ABSTFN))
00439 
00440             base = basename(ABSTFN)
00441             self.assertEqual(realpath(base + "link"), ABSTFN)
00442             self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k")
00443         finally:
00444             os.chdir(old_path)
00445             support.unlink(ABSTFN + "link")
00446             safe_rmdir(ABSTFN + "/k")
00447             safe_rmdir(ABSTFN)

Here is the call graph for this function:

Definition at line 375 of file test_posixpath.py.

00375 
00376     def test_realpath_resolve_parents(self):
00377         # We also need to resolve any symlinks in the parents of a relative
00378         # path passed to realpath. E.g.: current working directory is
00379         # /usr/doc with 'doc' being a symlink to /usr/share/doc. We call
00380         # realpath("a"). This should return /usr/share/doc/a/.
00381         try:
00382             old_path = abspath('.')
00383             os.mkdir(ABSTFN)
00384             os.mkdir(ABSTFN + "/y")
00385             os.symlink(ABSTFN + "/y", ABSTFN + "/k")
00386 
00387             os.chdir(ABSTFN + "/k")
00388             self.assertEqual(realpath("a"), ABSTFN + "/y/a")
00389         finally:
00390             os.chdir(old_path)
00391             support.unlink(ABSTFN + "/k")
00392             safe_rmdir(ABSTFN + "/y")
00393             safe_rmdir(ABSTFN)

Here is the call graph for this function:

Definition at line 350 of file test_posixpath.py.

00350 
00351     def test_realpath_symlink_loops(self):
00352         # Bug #930024, return the path unchanged if we get into an infinite
00353         # symlink loop.
00354         try:
00355             old_path = abspath('.')
00356             os.symlink(ABSTFN, ABSTFN)
00357             self.assertEqual(realpath(ABSTFN), ABSTFN)
00358 
00359             os.symlink(ABSTFN+"1", ABSTFN+"2")
00360             os.symlink(ABSTFN+"2", ABSTFN+"1")
00361             self.assertEqual(realpath(ABSTFN+"1"), ABSTFN+"1")
00362             self.assertEqual(realpath(ABSTFN+"2"), ABSTFN+"2")
00363 
00364             # Test using relative path as well.
00365             os.chdir(dirname(ABSTFN))
00366             self.assertEqual(realpath(basename(ABSTFN)), ABSTFN)
00367         finally:
00368             os.chdir(old_path)
00369             support.unlink(ABSTFN)
00370             support.unlink(ABSTFN+"1")
00371             support.unlink(ABSTFN+"2")

Here is the call graph for this function:

Definition at line 448 of file test_posixpath.py.

00448 
00449     def test_relpath(self):
00450         (real_getcwd, os.getcwd) = (os.getcwd, lambda: r"/home/user/bar")
00451         try:
00452             curdir = os.path.split(os.getcwd())[-1]
00453             self.assertRaises(ValueError, posixpath.relpath, "")
00454             self.assertEqual(posixpath.relpath("a"), "a")
00455             self.assertEqual(posixpath.relpath(posixpath.abspath("a")), "a")
00456             self.assertEqual(posixpath.relpath("a/b"), "a/b")
00457             self.assertEqual(posixpath.relpath("../a/b"), "../a/b")
00458             self.assertEqual(posixpath.relpath("a", "../b"), "../"+curdir+"/a")
00459             self.assertEqual(posixpath.relpath("a/b", "../c"),
00460                              "../"+curdir+"/a/b")
00461             self.assertEqual(posixpath.relpath("a", "b/c"), "../../a")
00462             self.assertEqual(posixpath.relpath("a", "a"), ".")
00463             self.assertEqual(posixpath.relpath("/foo/bar/bat", "/x/y/z"), '../../../foo/bar/bat')
00464             self.assertEqual(posixpath.relpath("/foo/bar/bat", "/foo/bar"), 'bat')
00465             self.assertEqual(posixpath.relpath("/foo/bar/bat", "/"), 'foo/bar/bat')
00466             self.assertEqual(posixpath.relpath("/", "/foo/bar/bat"), '../../..')
00467             self.assertEqual(posixpath.relpath("/foo/bar/bat", "/x"), '../foo/bar/bat')
00468             self.assertEqual(posixpath.relpath("/x", "/foo/bar/bat"), '../../../x')
00469             self.assertEqual(posixpath.relpath("/", "/"), '.')
00470             self.assertEqual(posixpath.relpath("/a", "/a"), '.')
00471             self.assertEqual(posixpath.relpath("/a/b", "/a/b"), '.')
00472         finally:
00473             os.getcwd = real_getcwd

Here is the call graph for this function:

Definition at line 474 of file test_posixpath.py.

00474 
00475     def test_relpath_bytes(self):
00476         (real_getcwdb, os.getcwdb) = (os.getcwdb, lambda: br"/home/user/bar")
00477         try:
00478             curdir = os.path.split(os.getcwdb())[-1]
00479             self.assertRaises(ValueError, posixpath.relpath, b"")
00480             self.assertEqual(posixpath.relpath(b"a"), b"a")
00481             self.assertEqual(posixpath.relpath(posixpath.abspath(b"a")), b"a")
00482             self.assertEqual(posixpath.relpath(b"a/b"), b"a/b")
00483             self.assertEqual(posixpath.relpath(b"../a/b"), b"../a/b")
00484             self.assertEqual(posixpath.relpath(b"a", b"../b"),
00485                              b"../"+curdir+b"/a")
00486             self.assertEqual(posixpath.relpath(b"a/b", b"../c"),
00487                              b"../"+curdir+b"/a/b")
00488             self.assertEqual(posixpath.relpath(b"a", b"b/c"), b"../../a")
00489             self.assertEqual(posixpath.relpath(b"a", b"a"), b".")
00490             self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/x/y/z"), b'../../../foo/bar/bat')
00491             self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/foo/bar"), b'bat')
00492             self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/"), b'foo/bar/bat')
00493             self.assertEqual(posixpath.relpath(b"/", b"/foo/bar/bat"), b'../../..')
00494             self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/x"), b'../foo/bar/bat')
00495             self.assertEqual(posixpath.relpath(b"/x", b"/foo/bar/bat"), b'../../../x')
00496             self.assertEqual(posixpath.relpath(b"/", b"/"), b'.')
00497             self.assertEqual(posixpath.relpath(b"/a", b"/a"), b'.')
00498             self.assertEqual(posixpath.relpath(b"/a/b", b"/a/b"), b'.')
00499 
00500             self.assertRaises(TypeError, posixpath.relpath, b"bytes", "str")
00501             self.assertRaises(TypeError, posixpath.relpath, "str", b"bytes")
00502         finally:
00503             os.getcwdb = real_getcwdb

Here is the call graph for this function:

Definition at line 180 of file test_posixpath.py.

00180 
00181     def test_samefile(self):
00182         test_fn = support.TESTFN + "1"
00183         self._create_file(test_fn)
00184         self.assertTrue(posixpath.samefile(test_fn, test_fn))
00185         self.assertRaises(TypeError, posixpath.samefile)

Here is the call graph for this function:

Definition at line 191 of file test_posixpath.py.

00191 
00192     def test_samefile_on_links(self):
00193         test_fn1 = support.TESTFN + "1"
00194         test_fn2 = support.TESTFN + "2"
00195         self._create_file(test_fn1)
00196 
00197         os.symlink(test_fn1, test_fn2)
00198         self.assertTrue(posixpath.samefile(test_fn1, test_fn2))
00199         os.remove(test_fn2)
00200 
00201         self._create_file(test_fn2)
00202         self.assertFalse(posixpath.samefile(test_fn1, test_fn2))
00203 

Here is the call graph for this function:

Definition at line 504 of file test_posixpath.py.

00504 
00505     def test_sameopenfile(self):
00506         fname = support.TESTFN + "1"
00507         with open(fname, "wb") as a, open(fname, "wb") as b:
00508             self.assertTrue(posixpath.sameopenfile(a.fileno(), b.fileno()))
00509 

Here is the call graph for this function:

Definition at line 204 of file test_posixpath.py.

00204 
00205     def test_samestat(self):
00206         test_fn = support.TESTFN + "1"
00207         self._create_file(test_fn)
00208         test_fns = [test_fn]*2
00209         stats = map(os.stat, test_fns)
00210         self.assertTrue(posixpath.samestat(*stats))

Here is the call graph for this function:

Definition at line 216 of file test_posixpath.py.

00216 
00217     def test_samestat_on_links(self):
00218         test_fn1 = support.TESTFN + "1"
00219         test_fn2 = support.TESTFN + "2"
00220         self._create_file(test_fn1)
00221         test_fns = (test_fn1, test_fn2)
00222         os.symlink(*test_fns)
00223         stats = map(os.stat, test_fns)
00224         self.assertTrue(posixpath.samestat(*stats))
00225         os.remove(test_fn2)
00226 
00227         self._create_file(test_fn2)
00228         stats = map(os.stat, test_fns)
00229         self.assertFalse(posixpath.samestat(*stats))
00230 
00231         self.assertRaises(TypeError, posixpath.samestat)

Here is the call graph for this function:

Definition at line 62 of file test_posixpath.py.

00062 
00063     def test_split(self):
00064         self.assertEqual(posixpath.split("/foo/bar"), ("/foo", "bar"))
00065         self.assertEqual(posixpath.split("/"), ("/", ""))
00066         self.assertEqual(posixpath.split("foo"), ("", "foo"))
00067         self.assertEqual(posixpath.split("////foo"), ("////", "foo"))
00068         self.assertEqual(posixpath.split("//foo//bar"), ("//foo", "bar"))
00069 
00070         self.assertEqual(posixpath.split(b"/foo/bar"), (b"/foo", b"bar"))
00071         self.assertEqual(posixpath.split(b"/"), (b"/", b""))
00072         self.assertEqual(posixpath.split(b"foo"), (b"", b"foo"))
00073         self.assertEqual(posixpath.split(b"////foo"), (b"////", b"foo"))
00074         self.assertEqual(posixpath.split(b"//foo//bar"), (b"//foo", b"bar"))

Here is the call graph for this function:

Definition at line 103 of file test_posixpath.py.

00103 
00104     def test_splitext(self):
00105         self.splitextTest("foo.bar", "foo", ".bar")
00106         self.splitextTest("foo.boo.bar", "foo.boo", ".bar")
00107         self.splitextTest("foo.boo.biff.bar", "foo.boo.biff", ".bar")
00108         self.splitextTest(".csh.rc", ".csh", ".rc")
00109         self.splitextTest("nodots", "nodots", "")
00110         self.splitextTest(".cshrc", ".cshrc", "")
00111         self.splitextTest("...manydots", "...manydots", "")
00112         self.splitextTest("...manydots.ext", "...manydots", ".ext")
00113         self.splitextTest(".", ".", "")
00114         self.splitextTest("..", "..", "")
00115         self.splitextTest("........", "........", "")
00116         self.splitextTest("", "", "")

Here is the call graph for this function:


The documentation for this class was generated from the following file: