@@ -30,36 +30,36 @@ def test_stats_usage(self):
30
30
31
31
# Test first creation of statistics file
32
32
self .stats_processor .update_stats (test_data1 )
33
- assert os .path .exists (stats_filename )
33
+ self . assertTrue ( os .path .exists (stats_filename ) )
34
34
with open (stats_filename , 'r' ) as file :
35
- assert file .readlines () == ['{\n ' , ' "value1": 12,\n ' , ' "value2": 7,\n ' , ' "value3": 8\n ' , '}' ]
35
+ self . assertTrue ( file .readlines () == ['{\n ' , ' "value1": 12,\n ' , ' "value2": 7,\n ' , ' "value3": 8\n ' , '}' ])
36
36
37
37
status , res = self .stats_processor .get_stats ()
38
- assert status
39
- assert res == test_data1
38
+ self . assertTrue ( status )
39
+ self . assertTrue ( res == test_data1 )
40
40
41
41
# Test updating of statistics file
42
42
test_data2 = {"value1" : 15 , "a" : "abs" }
43
43
self .stats_processor .update_stats (test_data2 )
44
- assert os .path .exists (stats_filename )
44
+ self . assertTrue ( os .path .exists (stats_filename ) )
45
45
with open (stats_filename , 'r' ) as file :
46
- assert file .readlines () == ['{\n ' , ' "value1": 15,\n ' , ' "a": "abs"\n ' , '}' ]
46
+ self . assertTrue ( file .readlines () == ['{\n ' , ' "value1": 15,\n ' , ' "a": "abs"\n ' , '}' ])
47
47
48
48
status , res = self .stats_processor .get_stats ()
49
- assert status
50
- assert res == test_data2
49
+ self . assertTrue ( status )
50
+ self . assertTrue ( res == test_data2 )
51
51
52
52
# Test removing of statistics file
53
53
self .stats_processor .remove_stats_file ()
54
- assert not os .path .exists (stats_filename )
54
+ self . assertFalse ( os .path .exists (stats_filename ) )
55
55
56
56
status , res = self .stats_processor .get_stats ()
57
- assert not status
58
- assert res == {}
57
+ self . assertFalse ( status )
58
+ self . assertTrue ( res == {})
59
59
60
60
# Test attempt to read incorrect statistics file
61
61
with open (stats_filename , 'w' ) as file :
62
62
file .write ("{ abc" )
63
63
status , res = self .stats_processor .get_stats ()
64
- assert not status
65
- assert res == {}
64
+ self . assertFalse ( status )
65
+ self . assertTrue ( res == {})
0 commit comments