Make sure slashes can be used and do not break the symlinks on the Object representation for repeated data.
(self)
| 225 | self.assertEqual( o, oo ) |
| 226 | |
| 227 | def testSlashesInRepeatedData(self): |
| 228 | """Make sure slashes can be used and do not break the symlinks on the Object representation for repeated data.""" |
| 229 | f = IECore.FileIndexedIO( os.path.join( ".", "test", "FileIndexedIOSlashes.fio" ), [], IECore.IndexedIO.OpenMode.Write) |
| 230 | |
| 231 | v1 = IECore.IntData(10) |
| 232 | v2 = IECore.IntData(11) |
| 233 | v3 = IECore.IntData(12) |
| 234 | |
| 235 | d = IECore.CompoundData() |
| 236 | d['a'] = IECore.CompoundData() |
| 237 | d['a']['b'] = v1 |
| 238 | d['a/b'] = v2 |
| 239 | d['c'] = IECore.CompoundData() |
| 240 | d['c']['d'] = v3 |
| 241 | d['c/d'] = v3 |
| 242 | d['links'] = IECore.CompoundData() |
| 243 | d['links']['v1'] = v1 |
| 244 | d['links']['v2'] = v2 |
| 245 | d['links']['v3'] = v3 |
| 246 | |
| 247 | # sanity check |
| 248 | self.assertTrue( d['a']['b'].isSame( d['links']['v1'] ) ) |
| 249 | self.assertTrue( d['a/b'].isSame( d['links']['v2'] ) ) |
| 250 | self.assertTrue( d['c']['d'].isSame( d['links']['v3'] ) ) |
| 251 | self.assertTrue( d['c/d'].isSame( d['links']['v3'] ) ) |
| 252 | |
| 253 | d.save( f, "test" ) |
| 254 | |
| 255 | f = None |
| 256 | f = IECore.FileIndexedIO(os.path.join( ".", "test", "FileIndexedIOSlashes.fio" ), [], IECore.IndexedIO.OpenMode.Read) |
| 257 | dd = IECore.Object.load( f, "test" ) |
| 258 | |
| 259 | self.assertEqual( d, dd ) |
| 260 | self.assertTrue( dd['a']['b'].isSame( dd['links']['v1'] ) ) |
| 261 | self.assertTrue( dd['a/b'].isSame( dd['links']['v2'] ) ) |
| 262 | self.assertTrue( dd['c']['d'].isSame( dd['links']['v3'] ) ) |
| 263 | self.assertTrue( dd['c/d'].isSame( dd['links']['v3'] ) ) |
| 264 | |
| 265 | def tearDown( self ) : |
| 266 |
nothing calls this directly
no test coverage detected