示例#1
0
def test_species_count():
    # manual
    assert_equals(3, hw2_manual.species_count(_pokemon_test))
    assert_equals(0, hw2_manual.species_count(_empty))
    # pandas
    assert_equals(3, hw2_pandas.species_count(_pokemon_test_df))
    assert_equals(0, hw2_pandas.species_count(_empty_df))
示例#2
0
def test_species_count():
    '''
    Test spcies_count funciton.
    '''
    print("test_species_count")
    print('Part0')
    assert_equals(3, hw2_manual.species_count(parsed_data))
    assert_equals(74, hw2_manual.species_count(parsed_data2))
    print('Part1')
    assert_equals(3, hw2_pandas.species_count(DATA))
    assert_equals(74, hw2_pandas.species_count(DATA2))
示例#3
0
def test_species_count():
    """
    Test the function species_count
    """
    print('Testing species_count')

    assert_equals(3, hw2_manual.species_count(data1))
    assert_equals(3, hw2_pandas.species_count(data2))
    assert_equals(82, hw2_manual.species_count(data3))
    assert_equals(82, hw2_pandas.species_count(data4))
    assert_equals(8, hw2_manual.species_count(data5))
    assert_equals(8, hw2_pandas.species_count(data6))
示例#4
0
def test_species_count():
    """
    Tests the function: species_count
    """
    print('Testing species_count')

    # Cases from the made up "spec" for this problem
    assert_equals(3, hw2_manual.species_count(data1))
    assert_equals(3, hw2_pandas.species_count(data2))
    # Additional two cases
    assert_equals(7, hw2_manual.species_count(data3))
    assert_equals(7, hw2_pandas.species_count(data4))
示例#5
0
def test_pandas_species_count():
    '''
    Tests the pandas species_count function
    '''

    test_data = pd.read_csv(POKEMON_TEST_FILE)
    my_data = pd.read_csv(MY_POKEMON_FILE)
    print('Testing species_count')

    # Spec test
    assert_equals(3, hw2_pandas.species_count(test_data))

    # My test
    assert_equals(5, hw2_pandas.species_count(my_data))
def test_species_count():
    """
    Tests the output of both versions of species_count() function.
    """

    # Test Part 0 - Manual
    print('Test species_count from Part 0 - Manual')

    assert_equals(3, hw2_manual.species_count(data_m1))
    assert_equals(82, hw2_manual.species_count(data_m2))

    # Test Part 1 - Pandas
    print('Test species_count from Part 1 - Pandas')

    assert_equals(3, hw2_pandas.species_count(data_p1))
    assert_equals(82, hw2_pandas.species_count(data_p2))
示例#7
0
def part1():
    """
    Calculates various statistics about the Pokemon dataset using
    the implementation in Part 1.
    """
    print('=== Starting Part 1 ===')
    data = pd.read_csv(DATA)

    print('Number of species:', hw2_pandas.species_count(data))
    print('Highest level pokemon:', hw2_pandas.max_level(data))
    print('Low-level Pokemon', hw2_pandas.filter_range(data, 1, 9))
    print('Average attack for fire types',
          hw2_pandas.mean_attack_for_type(data, 'fire'))
    print('Count of each Pokemon type:')
    print(hw2_pandas.count_types(data))
    print('Highest stage for each Pokemon type')
    print(hw2_pandas.highest_stage_per_type(data))
    print('Average attack for each Pokemon type')
    print(hw2_pandas.mean_attack_per_type(data))