Skip to content

Commit a908d51

Browse files
committed
added unit test making sure empty blindData doesn't get written to file
1 parent 1b17d4d commit a908d51

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/IECore/BlindDataHolder.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def testLoadSave(self):
102102

103103
b2 = Object.load( iface, "test" )
104104
self.assertEqual( b1, b2 )
105+
106+
# should have written a "blindData" entry into the indexed io hierarchy
107+
self.failUnless( isinstance( iface.directory( ["test","data","BlindDataHolder", "data", "blindData"], IndexedIO.MissingBehaviour.NullIfMissing ), IndexedIO ) )
105108

106109
# second test: overriding with no blind data
107110
b1 = BlindDataHolder()
@@ -124,6 +127,9 @@ def testLoadSave(self):
124127
g2 = Object.load( iface, "test" )
125128
self.assertEqual( g1, g2 )
126129

130+
# "blindData" entry should be excluded from the IndexedIO hierarchy
131+
self.assertEqual( iface.directory( ["test","data","Group", "data", "blindData"], IndexedIO.MissingBehaviour.NullIfMissing ), None )
132+
127133
def testHash( self ) :
128134

129135
b1 = BlindDataHolder()
@@ -135,9 +141,9 @@ def testHash( self ) :
135141
self.assertNotEqual( b1.hash(), b2.hash() )
136142

137143
def tearDown(self):
138-
139-
if os.path.isfile("./test/BlindDataHolder.fio") :
140-
os.remove("./test/BlindDataHolder.fio")
144+
pass
145+
#if os.path.isfile("./test/BlindDataHolder.fio") :
146+
# os.remove("./test/BlindDataHolder.fio")
141147

142148
if __name__ == "__main__":
143149
unittest.main()

0 commit comments

Comments
 (0)