def test_start_and_end_match_ids(): '''test case of start_and_end_match_ids() function for top economical bowlers''' expected_output = (518, 519) mock_matches = read_mock_matches() output = start_and_end_match_ids(mock_matches) assert expected_output == output
def test_start_and_end_match_id(): '''test case of start_and_end_match_id() function for extra runs conceded per team in 2016''' expected_output = (577, 578) mock_matches = read_mock_matches() output = start_and_end_match_id(mock_matches) assert expected_output == output
def test_extra_runs_conceded_per_team(): '''test case of extra_runs_conceded_per_team() function for extra runs conceded per team in 2016''' expected_output = { 'Kolkata Knight Riders': 1, 'Rising Pune Supergiants': 8 } mock_matches = read_mock_matches() mock_deliveries = read_mock_deliveries() start_id, end_id = start_and_end_match_id(mock_matches) output = extra_runs_conceded_per_team(mock_deliveries, start_id, end_id) assert expected_output == output
def test_matches_won_after_toss_decision(): '''test case of matches_won_after_toss_decision() function for matches won after toss decision''' expected_output = {2008: {}, 2009: {}, 2010: {}, 2011: {'bat': 1, 'field': 1}, 2015: {'field': 1}, 2016: {'field': 1}, 2017: {'field': 3, 'bat': 2}} mock_matches = read_mock_matches() output = matches_won_after_toss_decision(mock_matches) assert expected_output == output
def test_matches_played_per_year(): '''test case of matches_played_per_year() function for matches played per year''' expected_output = { 2008: 1, 2009: 1, 2010: 1, 2011: 2, 2015: 2, 2016: 2, 2017: 6 } mock_matches = read_mock_matches() output = matches_played_per_year(mock_matches) assert expected_output == output
def test_top_economical_bowlers(): '''test case of top_economical_bowlers() function for top economical bowlers''' expected_output = {5.0: 'NM Coulter-Nile', 6.0: 'JP Duminy', 6.5: 'Imran Tahir', 7.6: 'R Vinay Kumar', 8.33: 'SL Malinga', 8.5: 'DJ Muthuswami', 9.5: 'Harbhajan Singh', 11.0: 'JA Morkel', 11.5: 'PP Ojha', 12.67: 'JJ Bumrah'} mock_matches = read_mock_matches() mock_deliveries = read_mock_deliveries() start_id, end_id = start_and_end_match_ids(mock_matches) output = top_economical_bowlers(mock_deliveries, start_id, end_id) assert expected_output == output
def test_matches_won_by_team_per_year(): '''test case of matches_won_by_team_per_year() function for matches won by teams per year''' expected_output = ({ 'Sunrisers Hyderabad': { 2008: 0, 2009: 0, 2010: 0, 2011: 0, 2015: 0, 2016: 0, 2017: 2 }, 'Kolkata Knight Riders': { 2008: 1, 2009: 0, 2010: 1, 2011: 0, 2015: 1, 2016: 1, 2017: 1 }, 'Delhi Daredevils': { 2008: 0, 2009: 0, 2010: 0, 2011: 0, 2015: 0, 2016: 0, 2017: 3 }, 'Mumbai Indians': { 2008: 0, 2009: 1, 2010: 0, 2011: 0, 2015: 0, 2016: 0, 2017: 0 }, 'Chennai Super Kings': { 2008: 0, 2009: 0, 2010: 0, 2011: 1, 2015: 1, 2016: 0, 2017: 0 }, 'Rajasthan Royals': { 2008: 0, 2009: 0, 2010: 0, 2011: 1, 2015: 0, 2016: 0, 2017: 0 }, 'Rising Pune Supergiant': { 2008: 0, 2009: 0, 2010: 0, 2011: 0, 2015: 0, 2016: 1, 2017: 0 } }, [2008, 2009, 2010, 2011, 2015, 2016, 2017]) mock_matches = read_mock_matches() output = matches_won_by_team_per_year(mock_matches) assert expected_output == output