예제 #1
0
def test_get_missing_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
    date, time, count = animals.read_animals(date,time,animal,count,"Squirrel")
    
    assert date ==[]
    assert time == []
    assert count ==[]
예제 #2
0
def test_get_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
    date, time, count = animals.read_animals(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, 'Date mismatch 3'
    assert count == ref_counts, 'Count mismtach 3'
예제 #3
0
def test_read_animals():
    date, time, species, count = animals.read_animals('animals.txt')

    assert date == ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    assert time == ['21:06', '14:12', '10:24', '20:08', '18:46']
    assert species == ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
    assert count == [36, 25, 26, 31, 20]
예제 #4
0
def test_read_animals_date():
    reference_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23',
                      '2011-04-23']

    date, time, animal, number = animals.read_animals('animals.txt')

    assert date == reference_date, 'Date is wrong'
예제 #5
0
def test_read_animals():
    date, time, animal, number = animals.read_animals('animals.txt')
  
    reference_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    reference_time = ['21:06', '14:12', '10:24', '20:08', '18:46']

    assert date == reference_date, 'The date is wrong!'
    assert time == reference_time, 'The time is wrong!'
예제 #6
0
def test_read_animals_date():
    reference_date = [
        '2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23'
    ]

    date, time, animal, number = animals.read_animals('animals.txt')

    assert date == reference_date, 'Date is wrong'
예제 #7
0
def test_filter_animals():
    d, t, s, c = animals.read_animals('animals.txt')
    date, time, species, count = animals.filter_animals(d, t, s, c, 'Grizzly')

    assert date == ['2011-04-22']
    assert time == ['21:06']
    assert species == ['Grizzly']
    assert count == [36]
def test_read_animals():
    ref_dates = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    ref_times = ['21:06', '14:12', '10:24', '20:08', '18:46']
    ref_species = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
    ref_counts = ['36', '25', '26', '31', '20']

    dates, times, species, counts = animals.read_animals('animals.txt')

    assert dates == ref_dates
예제 #9
0
def test_read_animals():
    filename = 'animals.txt'
    date, time, animal, number = animals.read_animals(filename)

    ref_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    ref_time = ['21:06', '14:12', '10:24','20:08','18:46']
    ref_animals = ['Grizzly','Elk','Elk','Wolverine','Muskox']
    ref_counts = [ 36, 25, 26, 31, 20]
    assert date == ref_date
예제 #10
0
def test_filter_animals():
    date, time, animal, count = \
        animals.read_animals('animals.txt')

    species = 'Elk'
    date, time, animal, count = \
        animals.filter_animals(date, time, animal, count, species)

    assert count == [25, 26]
    assert animal == ['Elk', 'Elk']
예제 #11
0
def test_read_animals():
    date, time, animal, number = animals.read_animals('animals.txt')

    reference_date = [
        '2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23'
    ]
    reference_time = ['21:06', '14:12', '10:24', '20:08', '18:46']

    assert date == reference_date, 'The date is wrong!'
    assert time == reference_time, 'The time is wrong!'
예제 #12
0
def test_filter_animals():
    date, time, animal, count = \
        animals.read_animals('animals.txt')

    species = 'Elk'
    date, time, animal, count = \
        animals.filter_animals(date, time, animal, count, species)

    assert count == [25, 26]
    assert animal == ['Elk', 'Elk']
예제 #13
0
def test_filter_animals1():
    date, time, animal, count = \
        animals.read_animals('animals.txt')
    date, time, animal, count = \
        animals.filter_animals(date, time,
                               animal, count,
                               'Grizzly')
    assert date == ['2011-04-22']
    assert time == ['21:06']
    assert animal == ['Grizzly']
    assert count == [36]
예제 #14
0
def test_get_animal():
    date, time, animal, count = animals.read_animals("animals.txt")
    date, time, count = animals.get_animals(date, time, animal, count, "Elk")

    ref_date = ["2011-04-23", "2011-04-23"]
    ref_time = ["14:12", "10:24"]
    ref_animals = ["Elk", "Elk"]
    ref_counts = [25, 26]

    assert date == ref_date
    assert count == ref_counts
예제 #15
0
def test_filter_animals2():
    date, time, animal, count = \
        animals.read_animals('animals.txt')
    date, time, animal, count = \
        animals.filter_animals(date, time,
                               animal, count,
                               'Elk')
    assert date == ['2011-04-23', '2011-04-23']
    assert time == ['14:12', '10:24']
    assert animal == ['Elk', 'Elk']
    assert count == [25, 26]
예제 #16
0
def test_read_animals():
    filename = "animals.txt"

    date, time, animal, count = animals.read_animals(filename)

    ref_date = ["2011-04-22", "2011-04-23", "2011-04-23", "2011-04-23", "2011-04-23"]
    ref_time = ["21:06", "14:12", "10:24", "20:08", "18:46"]
    ref_animals = ["Grizzly", "Elk", "Elk", "Wolverine", "Muskox"]
    ref_counts = [36, 25, 26, 31, 20]

    assert date == ref_date, "Dates do not match"
    assert count == ref_counts, "counts do not match"
def test_read_animals():
    date, time, species, count = animals.read_animals('animals.txt')

    true_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    true_time = ['21:06', '14:12', '10:24', '20:08', '18:46']
    true_species = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
    true_count = [36, 25, 26, 31, 20]

    assert date == true_date, 'Dates not the same!'
    assert time == true_time, 'Times not the same!'
    assert species == true_species, 'Species not the same!'
    assert count == true_count, 'Counts not the same!'
예제 #18
0
def test_read_animals():
    ref_dates = [
        '2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23'
    ]
    ref_times = ['21:06', '14:12', '10:24', '20:08', '18:46']
    ref_species = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
    ref_counts = [36, 25, 26, 31, 20]

    dates, times, species, counts = animals.read_animals('animals.txt')

    assert dates == ref_dates
    assert times == ref_times
    assert species == ref_species
    assert counts == ref_counts
예제 #19
0
def test_read_animals():
	filename = 'animals.txt'
	
	date, time, animal, count = a.read_animals(filename)
	
	ref_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
	ref_time = ['21:06', '14:12', '10:24', '20:08', '18:46']
	ref_animal = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
	ref_count = [36, 31, 26, 25, 36]
	
	if date != ref_date:
		print "Dates don't match!"
	#Better:
	assert time == ref_time, "Woooooow, that went wrong with times"
def test_filter_animals():
    date, time, species, count = animals.read_animals('animals.txt')
    kind = 'Grizzly'
    d, t, s, c = animals.filter_animals_by_kind(kind, date, time, species, count)

    assert d == ['2011-04-22']
    assert t == ['21:06']
    assert s == ['Grizzly']
    assert c == [36]

    kind = 'Elk'
    d, t, s, c = animals.filter_animals_by_kind(kind, date, time, species, count)

    assert d == ['2011-04-23', '2011-04-23']
    assert t == ['14:12', '10:24']
    assert s == ['Elk', 'Elk']
    assert c == [25, 26]
예제 #21
0
def test_read_animals():
    '''
    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
    '''
    ref_dates = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
    ref_times = ['21:06', '14:12', '10:24', '20:08', '18:46']
    ref_species = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
    ref_counts = [36, 25, 26, 31, 20]

    dates, times, species, counts = animals.read_animals('animals.txt')
    assert dates == ref_dates
    assert times == ref_times
    assert species == ref_species
    assert counts == ref_counts
예제 #22
0
def test_filter_animals():
    date, time, species, count = animals.read_animals('animals.txt')
    kind = 'Grizzly'
    d, t, s, c = animals.filter_animals_by_kind(kind, date, time, species,
                                                count)

    assert d == ['2011-04-22']
    assert t == ['21:06']
    assert s == ['Grizzly']
    assert c == [36]

    kind = 'Elk'
    d, t, s, c = animals.filter_animals_by_kind(kind, date, time, species,
                                                count)

    assert d == ['2011-04-23', '2011-04-23']
    assert t == ['14:12', '10:24']
    assert s == ['Elk', 'Elk']
    assert c == [25, 26]
예제 #23
0
def test_number():
    date, time, animal, number = animals.read_animals('animals.txt')

    ref_numbers = [36, 25, 26, 31, 20]

    assert number == ref_numbers, 'The numbers are wrong!'
예제 #24
0
def test_read_animals_time():
    reference_time = ['21:06', '14:12', '10:24', '20:08', '18:46']

    date, time, animal, number = animals.read_animals('animals.txt')

    assert time == reference_time, 'Time is wrong'
예제 #25
0
def test_main():
    mean_count = animal.main("animals.txt","Elk")
    date, time, animal, count = animals.read_animals("animals.txt")
    mean_count = animals.mean_count(date,time,animal,count,"Elk")
    assert mean_count == 25.5
def test_read_animals():
    ref_dates = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']

    dates, time, species, counts = animals.read_animals('animals.txt')

    assert dates == ref_dates
예제 #27
0
def test_read_animals_time():
    reference_time = ['21:06', '14:12', '10:24', '20:08', '18:46']

    date, time, animal, number = animals.read_animals('animals.txt')

    assert time == reference_time, 'Time is wrong'
예제 #28
0
def test_number():
    date, time, animal, number = animals.read_animals('animals.txt')
    
    ref_numbers = [36, 25, 26, 31, 20]
    
    assert number == ref_numbers, 'The numbers are wrong!'
예제 #29
0
def test_read_animals_times():
    date, time, animal, count = \
        animals.read_animals('animals.txt')
    ref_t = ['21:06', '14:12', '10:24', '20:08', '18:46']
    assert time == ref_t, "Times don't match!"
예제 #30
0
def test_read_animals_counts():
    date, time, animal, count = \
        animals.read_animals('animals.txt')
    ref_c = [36, 25, 26, 31, 20]
    assert count == ref_c, "Counts don't match!"
예제 #31
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")
예제 #32
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 == []
예제 #33
0
import animals

date, time, animal, number = animals.read_animals('animals.txt')

reference_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']
reference_time = ['21:06', '14:12', '10:24', '20:08', '18:46']
reference_animal = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']
reference_number = [36, 25, 26, 31, 20]

def test_read_animals_date(): 
    assert date == reference_date, 'the date is wrong!'

def test_read_animals_time():
    assert time == reference_time, 'the time is wrong!'

def test_read_animals_animal():
    assert animal == reference_animal, 'the animals are wrong!'

def test_read_animals_number():
    assert number == reference_number, 'the number is wrong!'

def test_mean_elk():
    mean = animals.mean_animals('animals.txt', 'Elk')
    reference_mean = 25.5
    assert mean == reference_mean, 'the mean is wrong!'

def test_mean_wolverine():
    mean = animals.mean_animals('animals.txt', 'Wolverine')
    reference_mean = 31.0
    assert mean == reference_mean, 'the mean is wrong!'