Test FileIndexedIO mkdir
(self)
| 214 | self.assertTrue( g.entry('sub2').entryType() == IECore.IndexedIO.EntryType.Directory ) |
| 215 | |
| 216 | def testMkdir(self): |
| 217 | """Test FileIndexedIO mkdir""" |
| 218 | f = IECore.FileIndexedIO(os.path.join( ".", "test", "FileIndexedIO.fio" ), [], IECore.IndexedIO.OpenMode.Write) |
| 219 | g = f.subdirectory("sub1", IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 220 | self.assertEqual( f.path() , [] ) |
| 221 | self.assertEqual( f.currentEntryId() , "/" ) |
| 222 | self.assertEqual( g.path() , [ 'sub1' ] ) |
| 223 | self.assertEqual( g.currentEntryId() , "sub1" ) |
| 224 | |
| 225 | g = f.createSubdirectory("sub2" ) |
| 226 | self.assertEqual( f.path() , [] ) |
| 227 | self.assertEqual( g.path() , [ 'sub2' ] ) |
| 228 | self.assertEqual( g.currentEntryId() , "sub2" ) |
| 229 | self.assertRaises( RuntimeError, f.createSubdirectory, "sub2" ) |
| 230 | |
| 231 | # test directory |
| 232 | h = f.directory(["sub2"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 233 | self.assertEqual( h.path() , ["sub2"] ) |
| 234 | i = f.directory(["sub2","sub2.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 235 | self.assertEqual( i.path() , ["sub2","sub2.1"] ) |
| 236 | j = h.directory(["sub2","sub2.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 237 | self.assertEqual( j.path() , ["sub2","sub2.1"] ) |
| 238 | k = j.directory(["sub3"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 239 | self.assertEqual( k.path() , ["sub3"] ) |
| 240 | l = f.directory(["sub4","sub4.1"], IECore.IndexedIO.MissingBehaviour.CreateIfMissing ) |
| 241 | self.assertEqual( l.path() , ["sub4","sub4.1"] ) |
| 242 | |
| 243 | def testChdir(self): |
| 244 | """Test FileIndexedIO chdir""" |
nothing calls this directly
no test coverage detected