def test_no_error_if_rate_none(self, all_plans): all_plans[0]['rate'] = None second_lowest = pull_second_lowest_plan(all_plans) assert second_lowest['rate'] == '203.69'
def test_no_error_if_dict_missing_key(self, all_plans): del all_plans[0]['rate'] second_lowest = pull_second_lowest_plan(all_plans) assert second_lowest['rate'] == '203.69'
def test_no_error_if_rate_bad_format(self, all_plans): all_plans[0]['rate'] = 'error' second_lowest = pull_second_lowest_plan(all_plans) assert second_lowest['rate'] == '203.69'
def test_returns_none_if_empty_list(self, all_plans): second_lowest = pull_second_lowest_plan([]) assert second_lowest is None
def test_returns_none_if_only_one(self, all_plans): only_plan = all_plans[:1] second_lowest = pull_second_lowest_plan(only_plan) assert second_lowest is None
def test_pulls_second_lowest_rate_plan_with_two_plans(self, all_plans): two_plans = all_plans[:2] second_lowest = pull_second_lowest_plan(two_plans) assert second_lowest['rate'] == '370.8'
def test_pulls_second_lowest_rate_plan_separate_order(self, all_plans): new_plans = list(reversed(all_plans)) second_lowest = pull_second_lowest_plan(new_plans) assert second_lowest['rate'] == '203.69' assert second_lowest['metal_level'] == 'Bronze'
def test_pulls_second_lowest_rate_plan(self, all_plans): second_lowest = pull_second_lowest_plan(all_plans) assert second_lowest['rate'] == '203.69' assert second_lowest['metal_level'] == 'Bronze'