Python ntpath.splitunc() Examples
The following are 10
code examples of ntpath.splitunc().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ntpath
, or try the search function
.
Example #1
Source File: test_ntpath.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_splitunc(self): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) if test_support.have_unicode: self.assertEqual(ntpath.splitunc(u'//conky/MOUNTPO%cNT/foo/bar' % 0x0130), (u'//conky/MOUNTPO%cNT' % 0x0130, u'/foo/bar'))
Example #2
Source File: test_ntpath.py From oss-ftp with MIT License | 6 votes |
def test_splitunc(self): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) self.assertEqual(ntpath.splitunc(u'//conky/MOUNTPO\u0130NT/foo/bar'), (u'//conky/MOUNTPO\u0130NT', u'/foo/bar'))
Example #3
Source File: test_ntpath.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_splitunc(self): with self.assertWarns(DeprecationWarning): ntpath.splitunc('') with support.check_warnings(('', DeprecationWarning)): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) self.assertEqual(ntpath.splitunc('//conky/MOUNTPOİNT/foo/bar'), ('//conky/MOUNTPOİNT', '/foo/bar'))
Example #4
Source File: test_ntpath.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_splitunc(self): with self.assertWarns(DeprecationWarning): ntpath.splitunc('') with support.check_warnings(('', DeprecationWarning)): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) self.assertEqual(ntpath.splitunc('//conky/MOUNTPOİNT/foo/bar'), ('//conky/MOUNTPOİNT', '/foo/bar'))
Example #5
Source File: test_ntpath.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_splitunc(self): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) self.assertEqual(ntpath.splitunc(u'//conky/MOUNTPO\u0130NT/foo/bar'), (u'//conky/MOUNTPO\u0130NT', u'/foo/bar'))
Example #6
Source File: test_ntpath.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_splitunc(self): with self.assertWarns(DeprecationWarning): ntpath.splitunc('') with support.check_warnings(('', DeprecationWarning)): tester('ntpath.splitunc("c:\\foo\\bar")', ('', 'c:\\foo\\bar')) tester('ntpath.splitunc("c:/foo/bar")', ('', 'c:/foo/bar')) tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar')) tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")', ('', '\\\\\\conky\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("///conky/mountpoint/foo/bar")', ('', '///conky/mountpoint/foo/bar')) tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")', ('', '\\\\conky\\\\mountpoint\\foo\\bar')) tester('ntpath.splitunc("//conky//mountpoint/foo/bar")', ('', '//conky//mountpoint/foo/bar')) self.assertEqual(ntpath.splitunc('//conky/MOUNTPOİNT/foo/bar'), ('//conky/MOUNTPOİNT', '/foo/bar'))
Example #7
Source File: test_ntpath.py From BinderFilter with MIT License | 5 votes |
def test_splitunc(self): tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))
Example #8
Source File: test_ntpath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_splitunc(self): tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))
Example #9
Source File: baseClass.py From fimap with GNU General Public License v2.0 | 5 votes |
def relpath_win(self, path, start="."): """Return a relative version of a path""" sep="\\" if not path: raise ValueError("no path specified") start_list = ntpath.abspath(start).split(sep) path_list = ntpath.abspath(path).split(sep) if start_list[0].lower() != path_list[0].lower(): unc_path, rest = ntpath.splitunc(path) unc_start, rest = ntpath.splitunc(start) if bool(unc_path) ^ bool(unc_start): raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" % (path, start)) else: raise ValueError("path is on drive %s, start on drive %s" % (path_list[0], start_list[0])) # Work out how much of the filepath is shared by start and path. for i in range(min(len(start_list), len(path_list))): if start_list[i].lower() != path_list[i].lower(): break else: i += 1 rel_list = ['..'] * (len(start_list)-i) + path_list[i:] if not rel_list: return "." return ntpath.join(*rel_list)
Example #10
Source File: test_ntpath.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_splitunc(self): tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint', '\\foo\\bar')) tester('ntpath.splitunc("//conky/mountpoint/foo/bar")', ('//conky/mountpoint', '/foo/bar'))