def test_cat_wait_after_dequeue_dog(): shelter = AnimalShelter() shelter.enqueue(ferran) shelter.enqueue(jora) shelter.dequeue('dog') actual = shelter.cat_wait expected = 1 assert actual == expected
def test_animal_dequeue_several_types(): animal_instance_one = Animal("cat", "Meow") animal_instance_two = Animal("dog", "Bark") shelter_instance = AnimalShelter() shelter_instance.enqueue(animal_instance_one) shelter_instance.enqueue(animal_instance_two) shelter_instance.dequeue("cat") actual = shelter_instance.dequeue("dog") expected = animal_instance_two assert actual == expected
def test_animal_dequeue_several(): animal_instance_one = Animal("dog", "Trump") animal_instance_two = Animal("dog", "Ivanka") shelter_instance = AnimalShelter() shelter_instance.enqueue(animal_instance_one) shelter_instance.enqueue(animal_instance_two) shelter_instance.dequeue("dog") actual = shelter_instance.dequeue("dog") expected = animal_instance_two assert actual == expected
def test_dequq_without_param(): shelter = AnimalShelter() shelter.enqueue('cat') shelter.enqueue('dog') shelter.enqueue('cat') shelter.enqueue('dog') shelter.dequeue() actual = str(shelter) expected = 'dog -> cat -> dog -> Null' assert actual == expected
def test_dequeue_no_pref_dog_wait(): shelter = AnimalShelter() shelter.enqueue(jora) shelter.enqueue(ferran) shelter.enqueue(raya) shelter.enqueue(athena) shelter.dequeue() actual = shelter.dog_wait expected = 1 assert actual == expected
def test_multi_dequeue_cat(): shelter = AnimalShelter() shelter.enqueue(ferran) shelter.enqueue(jora) shelter.enqueue(raya) shelter.enqueue(athena) shelter.dequeue('cat') shelter.dequeue('cat') actual = shelter.cat.front expected = None assert actual == expected
def test_dog_wait_after_multi_dequeue_cat(): shelter = AnimalShelter() shelter.enqueue(ferran) shelter.enqueue(jora) shelter.enqueue(raya) shelter.enqueue(athena) shelter.dequeue('cat') shelter.dequeue('cat') actual = shelter.dog_wait expected = 2 assert actual == expected
def test_single_animal(): shelter = AnimalShelter() cat = Cat() shelter.enqueue(cat) actual = shelter.dequeue("cat") expected = cat assert actual == expected
def test_enqueue_cat(): a = AnimalShelter() c = Cat() a.enqueue(c) actual = a.dequeue("cat") excepted = c assert actual == excepted
def test_animal_dequeue_one(): animal_instance = Animal("cat", "Carl") shelter_instance = AnimalShelter() shelter_instance.enqueue(animal_instance) actual = shelter_instance.dequeue("cat") expected = animal_instance assert actual == expected
def test_dequeue_pref_dog(): shelter = AnimalShelter() shelter.enqueue(ferran) shelter.enqueue(jora) actual = shelter.dequeue('dog') expected = 'Jora' assert actual == expected
def test_dequeue_pref_cat(): shelter = AnimalShelter() shelter.enqueue(ferran) shelter.enqueue(jora) actual = shelter.dequeue('cat') expected = 'Ferran' assert actual == expected
def test_animal_dequeue(): shelter = AnimalShelter() cat = Cat() dog = Dog() shelter.enqueue(cat) shelter.enqueue(dog) shelter.enqueue(dog) actual = shelter.dequeue('dog') expected = dog assert actual == expected
def test_dequeue_no_pref_wait_even(): #program currently defaults to cat shelter = AnimalShelter() shelter.enqueue(jora) shelter.enqueue(ferran) shelter.enqueue(raya) shelter.enqueue(athena) actual = shelter.dequeue() expected = 'Ferran' assert actual == expected
def test_dequeue_not_cat_or_dog(): ams = AnimalShelter() with pytest.raises(InvalidOperationError): ams.dequeue('mouse')
def test_dequeue_dog(): ams = AnimalShelter() ams.enqueue('cat') ams.enqueue('dog') ams.dequeue('dog') assert ams.dog_queue.is_empty() == True