def testNormalize(self): """Test argument being normalized.""" cases = [ ('//', ['/']), ('///', ['/']), ('/abc/', ['/', '/abc']), ('/abc//def', ['/', '/abc', '/abc/def']), ] for inp, exp in cases: self.assertEquals(list(osutils.IteratePaths(inp)), exp)
def testTwoDirs(self): """Test iterating two dirs down.""" inp = '/abc/def' exp = ['/', '/abc', '/abc/def'] self.assertEquals(list(osutils.IteratePaths(inp)), exp)
def testRoot(self): """Test iterating from root directory.""" inp = '/' exp = ['/'] self.assertEquals(list(osutils.IteratePaths(inp)), exp)
def testOneDir(self): """Test iterating from a directory in a root directory.""" inp = '/abc' exp = ['/', '/abc'] self.assertEquals(list(osutils.IteratePaths(inp)), exp)
def testType(self): """Check that return value is an iterator.""" self.assertTrue(isinstance(osutils.IteratePaths('/'), collections.Iterator))