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
2527
2628class StatementsResultTest (TinCanBaseTestCase ):
2729 def test_serialize_deserialize (self ):
2830 sr = StatementsResult ()
29- sr .statements = [1 , 2 , 3 , ]
31+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
32+ sr .statements = [Statement (id = uuid_str ), Statement (id = uuid_str ), Statement (id = uuid_str ), ]
3033 sr .more = 'http://www.example.com/more/1234'
3134
3235 self .assertSerializeDeserialize (sr )
3336
3437 def test_serialize_deserialize_init (self ):
38+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
3539 data = {
36- 'statements' : [1 , 2 , 3 , 4 , ],
40+ 'statements' : [Statement ( id = uuid_str ), Statement ( id = uuid_str ), Statement ( id = uuid_str ), Statement ( id = uuid_str ) , ],
3741 'more' : 'http://www.example.com/more/1234' ,
3842 }
3943
@@ -44,11 +48,12 @@ def test_read_write(self):
4448 sr = StatementsResult ()
4549 self .assertEqual (len (sr .statements ), 0 , 'Empty StatementsResult inited as non-empty!' )
4650
47- sr .statements = (1 , 2 , 3 ,)
51+ uuid_str = '016699c6-d600-48a7-96ab-86187498f16f'
52+ sr .statements = (Statement (id = uuid_str ), Statement (id = uuid_str ), Statement (id = uuid_str ),)
4853 self .assertIsInstance (sr .statements , list , 'Did not convert tuple to list!' )
4954
50- sr .statements .append (4 )
51- self .assertEqual (sr .statements [3 ], 4 , 'Did not append value!' )
55+ sr .statements .append (Statement ( id = uuid_str ) )
56+ self .assertEqual (sr .statements [3 ]. id , uuid . UUID ( '016699c6-d600-48a7-96ab-86187498f16f' ) , 'Did not append value!' )
5257
5358 self .assertIsNone (sr .more )
5459
@@ -59,4 +64,4 @@ def test_read_write(self):
5964
6065if __name__ == '__main__' :
6166 suite = unittest .TestLoader ().loadTestsFromTestCase (StatementsResultTest )
62- unittest .TextTestRunner (verbosity = 2 ).run (suite )
67+ unittest .TextTestRunner (verbosity = 2 ).run (suite )
0 commit comments