1515# limitations under the License.
1616
1717import unittest
18+ import uuid
1819
1920if __name__ == '__main__' :
2021 from main import setup_tincan_path
2122 setup_tincan_path ()
2223from tincan .statements_result import StatementsResult
24+ from tincan .statement import Statement
2325from test_utils import TinCanBaseTestCase
2426
25-
2627class StatementsResultTest (TinCanBaseTestCase ):
2728 def test_serialize_deserialize (self ):
2829 sr = StatementsResult ()
29- sr .statements = [1 , 2 , 3 , ]
30+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
31+ sr .statements = [Statement (id = uuid_str ), Statement (id = uuid_str ), Statement (id = uuid_str ), ]
3032 sr .more = 'http://www.example.com/more/1234'
3133
3234 self .assertSerializeDeserialize (sr )
3335
3436 def test_serialize_deserialize_init (self ):
37+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
3538 data = {
36- 'statements' : [1 , 2 , 3 , 4 , ],
39+ 'statements' : [Statement ( id = uuid_str ), Statement ( id = uuid_str ), Statement ( id = uuid_str ), Statement ( id = uuid_str ) , ],
3740 'more' : 'http://www.example.com/more/1234' ,
3841 }
3942
@@ -44,11 +47,12 @@ def test_read_write(self):
4447 sr = StatementsResult ()
4548 self .assertEqual (len (sr .statements ), 0 , 'Empty StatementsResult inited as non-empty!' )
4649
47- sr .statements = (1 , 2 , 3 ,)
50+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
51+ sr .statements = (Statement (id = uuid_str ), Statement (id = uuid_str ), Statement (id = uuid_str ),)
4852 self .assertIsInstance (sr .statements , list , 'Did not convert tuple to list!' )
4953
50- sr .statements .append (4 )
51- self .assertEqual (sr .statements [3 ], 4 , 'Did not append value!' )
54+ sr .statements .append (Statement ( id = uuid_str ) )
55+ self .assertEqual (sr .statements [3 ]. id , uuid . UUID ( '016699c6-d600-48a7-96ab-86187498f16f' ) , 'Did not append value!' )
5256
5357 self .assertIsNone (sr .more )
5458
@@ -59,4 +63,4 @@ def test_read_write(self):
5963
6064if __name__ == '__main__' :
6165 suite = unittest .TestLoader ().loadTestsFromTestCase (StatementsResultTest )
62- unittest .TextTestRunner (verbosity = 2 ).run (suite )
66+ unittest .TextTestRunner (verbosity = 2 ).run (suite )
0 commit comments