def test_highest_stage_per_type(): """ Tests the output of both versions of highest_stage_per_type() function. """ answer_1 = {'fire': 2, 'water': 2} answer_2 = ({ 'normal': 2, 'fire': 3, 'water': 2, 'fighting': 2, 'grass': 3, 'poison': 3, 'bug': 3, 'fairy': 1, 'psychic': 3, 'rock': 3, 'flying': 3, 'ghost': 3, 'ground': 2, 'electric': 1 }) # Test Part 0 - Manual print('Test highest_stage_per_type from Part 0 - Manual') assert_equals(answer_1, hw2_manual.highest_stage_per_type(data_m1)) assert_equals(answer_2, hw2_manual.highest_stage_per_type(data_m2)) # Test Part 1 - Pandas print('Test highest_stage_per_type from Part 1 - Pandas') assert_equals(answer_1, hw2_pandas.highest_stage_per_type(data_p1)) assert_equals(answer_2, hw2_pandas.highest_stage_per_type(data_p2))
def test_highest_stage_per_type(): """ Tests the function: highest_stage_per_type """ print('Testing highest_stage_per_type') # Cases from the made up "spec" for this problem assert_equals({ 'water': 2, 'fire': 2 }, hw2_manual.highest_stage_per_type(data1)) assert_equals({ 'water': 2, 'fire': 2 }, hw2_pandas.highest_stage_per_type(data2)) # Additional two cases assert_equals({ 'fighting': 2, 'fire': 2, 'normal': 2, 'water': 2 }, hw2_manual.highest_stage_per_type(data3)) assert_equals({ 'fighting': 2, 'fire': 2, 'normal': 2, 'water': 2 }, hw2_pandas.highest_stage_per_type(data4))
def test_highest_stage_per_type(): # manual assert_equals({ 'fire': 2, 'water': 2 }, hw2_manual.highest_stage_per_type(_pokemon_test)) assert_equals({'normal': 2}, hw2_manual.highest_stage_per_type(_single)) # pandas assert_equals({ 'fire': 2, 'water': 2 }, hw2_pandas.highest_stage_per_type(_pokemon_test_df)) assert_equals({'normal': 2}, hw2_pandas.highest_stage_per_type(_single_df))
def test_highest_stage_per_type(): """ Test the function highest_stage_per_type """ print('Testing highest_stage_per_type') assert_equals({'water': 2, 'fire': 2}, hw2_manual.highest_stage_per_type(data1)) assert_equals({'water': 2, 'fire': 2}, hw2_pandas.highest_stage_per_type(data2)) assert_equals({'fighting': 2, 'fire': 1, 'grass': 3, 'normal': 1, 'poison': 1, 'water': 2}, hw2_manual.highest_stage_per_type(data5)) assert_equals({'fighting': 2, 'fire': 1, 'grass': 3, 'normal': 1, 'poison': 1, 'water': 2}, hw2_pandas.highest_stage_per_type(data6))
def test_manual_highest_stage_per_type(): ''' Tests the manual highest_stage_per_type function ''' test_data = parse(POKEMON_TEST_FILE) my_data = parse(MY_POKEMON_FILE) print('Testing highest_stage_per_type function') # Spec test expected = {'water': 2, 'fire': 2} received = hw2_manual.highest_stage_per_type(test_data) assert_equals(expected, received) # My test expected = {'water': 2, 'fire': 2, 'pyschic': 2, 'normal': 0} received = hw2_manual.highest_stage_per_type(my_data) assert_equals(expected, received)
def test_highest_stage_per_type(): ''' Test highest_stage_per_type funciton. ''' print("test_highest_stage_per_type") print('Part0') assert_equals({'water': 2, 'fire': 2}, hw2_manual.highest_stage_per_type(parsed_data)) assert_equals({'bug': 3, 'electric': 1, 'fairy': 1, 'fighting': 2, 'fire': 3, 'flying': 3, 'ghost': 3, 'grass': 3, 'ground': 2, 'normal': 2, 'poison': 3, 'psychic': 2, 'rock': 2, 'water': 2}, hw2_manual.highest_stage_per_type(parsed_data2)) print('Part1') assert_equals({'water': 2, 'fire': 2}, hw2_pandas.highest_stage_per_type(DATA)) assert_equals({'bug': 3, 'electric': 1, 'fairy': 1, 'fighting': 2, 'fire': 3, 'flying': 3, 'ghost': 3, 'grass': 3, 'ground': 2, 'normal': 2, 'poison': 3, 'psychic': 2, 'rock': 2, 'water': 2}, hw2_pandas.highest_stage_per_type(DATA2))
def part0(): """ Calculates various statistics about the Pokemon dataset using the implementation in Part 0. """ print('=== Starting Part 0 ===') data = cse163_utils.parse(DATA) print('Number of species:', hw2_manual.species_count(data)) print('Highest level pokemon:', hw2_manual.max_level(data)) print('Low-level Pokemon', hw2_manual.filter_range(data, 1, 9)) print('Average attack for fire types', hw2_manual.mean_attack_for_type(data, 'fire')) print('Count of each Pokemon type:') print(hw2_manual.count_types(data)) print('Highest stage for each Pokemon type') print(hw2_manual.highest_stage_per_type(data)) print('Average attack for each Pokemon type') print(hw2_manual.mean_attack_per_type(data))