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 ==[]
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'
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]
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'
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!'
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'
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
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
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']
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!'
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]
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
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]
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!'
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
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]
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
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!'
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'
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
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!"
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!"
def test_get_animal(): date, time, animal, count = animals.read_animals("animals.txt") date, time, count = animals.get_animal(date, time, animal, count, "Elk")
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 == []
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!'