Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from e23_test_scores import print_scores 

2import pytest 

3 

4 

5@pytest.fixture 

6def score_file_1(tmp_path): 

7 j1 = tmp_path / '9a.json' 

8 j1.write_text(''' 

9[{"math" : 90, "literature" : 98, "science" : 97}, 

10 {"math" : 65, "literature" : 79, "science" : 85}, 

11 {"math" : 78, "literature" : 83, "science" : 75}, 

12 {"math" : 92, "literature" : 78, "science" : 85}, 

13 {"math" : 100, "literature" : 80, "science" : 90} 

14] 

15''') 

16 return j1 

17 

18 

19@pytest.fixture 

20def score_file_2(tmp_path): 

21 j2 = tmp_path / '9a.json' 

22 j2.write_text(''' 

23[{"math" : 70, "literature" : 98, "science" : 97}, 

24 {"math" : 65, "literature" : 83, "science" : 70}, 

25 {"math" : 58, "literature" : 83, "science" : 75}, 

26 {"math" : 72, "literature" : 78, "science" : 85}, 

27 {"math" : 100, "literature" : 80, "science" : 90} 

28] 

29''') 

30 return j2 

31 

32 

33def test_scores(tmp_path, capsys, score_file_1, score_file_2): 

34 print_scores(tmp_path) 

35 captured_out, captured_err = capsys.readouterr() 

36 assert captured_out.count(' min ') == 2 

37 assert captured_out.count(' max ') == 2 

38 assert captured_out.count(' average ') == 2