Example #1
0
def test_get_animal():
    '''
    Test the get_animal function
    '''

    fname = 'animals.txt'
    animal = 'Elk'

    # reference data
    # 2011-04-22 21:06 Grizzly 36
    # 2011-04-23 14:12 Elk 25
    # 2011-04-23 10:24 Elk 26
    # 2011-04-23 20:08 Wolverine 31
    # 2011-04-23 18:46 Muskox 20

    elk_dates = ['2011-04-23','2011-04-23']
    elk_times = ['14:12','10:24']
    elk_sightings = [25,26]
    
    data = animals.read_animals_file(fname)
    test_dates, test_times, test_sightings = (
        animals.get_animal(data,animal)
        )

    assert test_dates == elk_dates, 'test_dates not same as elk_dates'
    assert test_times == elk_times, 'test_times not same as elk_times'
    assert test_sightings == elk_sightings, 'test_sightings not same as elk_sightings'
Example #2
0
def test_get_animal():
    '''
    Test the get_animal function
    '''

    fname = 'animals.txt'
    animal = 'Elk'

    # reference data
    # 2011-04-22 21:06 Grizzly 36
    # 2011-04-23 14:12 Elk 25
    # 2011-04-23 10:24 Elk 26
    # 2011-04-23 20:08 Wolverine 31
    # 2011-04-23 18:46 Muskox 20

    elk_dates = ['2011-04-23', '2011-04-23']
    elk_times = ['14:12', '10:24']
    elk_sightings = [25, 26]

    data = animals.read_animals_file(fname)
    test_dates, test_times, test_sightings = (animals.get_animal(data, animal))

    assert test_dates == elk_dates, 'test_dates not same as elk_dates'
    assert test_times == elk_times, 'test_times not same as elk_times'
    assert test_sightings == elk_sightings, 'test_sightings not same as elk_sightings'
Example #3
0
def test_get_missing_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
    date, time, count = animals.get_animal(
        date, time, animal, count, "Squirrel")
    assert date == []
    assert time == []
    assert count == []
Example #4
0
def test_get_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
    date, time, count = animals.get_animal(
        date, time, animal, count, "Elk")
    
    ref_date = ['2011-04-23', '2011-04-23']
    ref_time = ['14:12', '10:24']
    ref_counts = [25, 26]
    
    assert date == ref_date, 'Dates do not match!'
    assert count == ref_counts, 'Counts do not match!'
Example #5
0
def test_get_missing_animal():
	d, t, an, c = a.read_animals("animals.txt")
	d, t, c = a.get_animal(d, t, an, c, "Squirrel")
	assert d == []
	assert t == []
	assert c == []
Example #6
0
def test_get_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
        date, time, count = animals.get_animal(date, time, animal, count, "Elk")