-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_susi_grade_geter.py
46 lines (36 loc) · 1.6 KB
/
test_susi_grade_geter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from get_SUSI_grades import *
import unittest
from unittest.mock import patch
class TestSusiGradeGetter(unittest.TestCase):
def test_when_unvalid_login_details_are_given(self):
login_data=('UnknownName','stupidPassword')
self.assertRaises(Exception,main_info_geter,login_data[0],login_data[1])
def test_when_not_equal_list_of_subjects_lectors_grades_is_give_to_the_print_function1(self):
lst1=[1,2,3,4]
lst2=[4,4]
lst3=[3,1,3]
self.assertRaises(Exception,print_student_info)
def test_when_not_equal_list_of_subjects_lectors_grades_is_give_to_the_print_function2(self):
lst1=[1,2,3,4]
lst2=[4,4,5]
lst3=[3,1,3]
self.assertRaises(Exception,print_student_info)
def test_when_not_equal_list_of_subjects_lectors_grades_is_give_to_the_print_function3(self):
lst1=[1,2,3,4]
lst2=[4,4,2,1]
lst3=[3,1,]
self.assertRaises(Exception,print_student_info)
def test_when_not_equal_list_of_subjects_lectors_grades_is_give_to_the_print_function4(self):
lst1=[1,2,3]
lst2=[4,4,2,1]
lst3=[3,1,3,1]
self.assertRaises(Exception,print_student_info)
@patch("builtins.print")
def test_when_equal_list_of_subjects_lectors_grades_is_give_to_the_print_function(self,mock_print):
lst1=[1,2,3,4]
lst2=[4,4,2,1]
lst3=[3,1,2,1]
print_student_info(lst1,lst2,lst3)
mock_print.assert_called_with('Средно аритметично то всички взети изпити:',sum(lst3)/len(lst3))
if __name__=="__main__":
unittest.main()