7 from testmodel
import InnerModel
8 from testmodel
import NestedModel
10 from cola
.model
import Model
12 class SaveRestoreTest(testutils
.TestCase
):
15 testutils
.TestCase
.setUp(self
)
16 self
.nested
= NestedModel()
17 path
= os
.path
.join(self
.testDir(), 'test.data')
18 self
.nested
.save(path
)
20 self
.clone
= Model
.instance(path
)
22 def testCloneToClass(self
):
23 self
.failUnless( str(NestedModel
) ==
24 str(self
.clone
.__class
__) )
26 def testClonedInnerToClass(self
):
27 self
.failUnless( str(InnerModel
) ==
28 str(self
.clone
.inner
.__class
__) )
30 def testClonedListAndParam(self
):
31 self
.failUnless( str(self
.clone
.inner
.__class
__) ==
32 str(self
.clone
.innerList
[0].__class
__) )
35 self
.failUnless( str(InnerModel
) ==
36 str(self
.clone
.innerList
[1][0].__class
__) )
38 def testListInList(self
):
39 self
.failUnless( str(InnerModel
) ==
40 str(self
.clone
.innerList
[2][0][0].__class
__))
42 def testListInListInList(self
):
43 self
.failUnless( str(InnerModel
) ==
44 str(self
.clone
.innerList
[3][0][0][0].__class
__))
46 def testDictInList(self
):
47 self
.failUnless( str(dict) ==
48 str(self
.clone
.innerList
[4].__class
__))
50 def testObjectInDictInList(self
):
51 self
.failUnless( str(InnerModel
) ==
52 str(self
.clone
.innerList
[-1]["foo"].__class
__))
54 if __name__
== '__main__':