Esempio n. 1
0
 def test_getNamedPath(self):
     """getNamedPath should have known result"""
     curloc = os.path.abspath(os.path.curdir)
     tmpdir = os.path.join(curloc, 'tmp', 'test1', 'test2')
     os.makedirs(tmpdir)
     ans = ['tests', 'tmp', 'test1']
     os.chdir(tmpdir)
     res = tb.getNamedPath('test1').split(os.path.sep)[-3:]
     self.assertEqual(ans[0], res[0][0:len(ans[0])])
     self.assertEqual(ans[1], res[1][0:len(ans[0])])
     self.assertEqual(res[0],
                      tb.getNamedPath(res[0]).split(os.path.sep)[-1])
     os.chdir(curloc)
     os.removedirs(tmpdir)
Esempio n. 2
0
 def test_getNamedPath(self):
     """getNamedPath should have known result"""
     curloc = os.path.abspath(os.path.curdir)
     tmpdir = os.path.join(curloc, 'tmp', 'test1', 'test2')
     os.makedirs(tmpdir)
     ans = ['tests', 'tmp', 'test1']
     os.chdir(tmpdir)
     res = tb.getNamedPath('test1').split(os.path.sep)[-3:]
     self.assertEqual(ans[0], res[0][0:len(ans[0])])
     self.assertEqual(ans[1], res[1][0:len(ans[0])])
     self.assertEqual(res[0],
                      tb.getNamedPath(res[0]).split(os.path.sep)[-1])
     os.chdir(curloc)
     os.removedirs(tmpdir)
Esempio n. 3
0
 def test_getNamedPath_badInput(self):
     """getNamedPath should return None if directory does not exist"""
     import string, random
     len_fn = 16 #should be exceedingly unlikely to exist...
     dname = ''.join(random.choice(string.ascii_uppercase + 
                     string.digits) for _ in range(len_fn))
     res = tb.getNamedPath(dname)
     self.assertTrue(res is None)
Esempio n. 4
0
 def test_getNamedPath_badInput(self):
     """getNamedPath should return None if directory does not exist"""
     import string, random
     len_fn = 16 #should be exceedingly unlikely to exist...
     dname = ''.join(random.choice(string.ascii_uppercase + 
                     string.digits) for _ in range(len_fn))
     res = tb.getNamedPath(dname)
     self.assertTrue(res is None)