def test_dequeue(): animal = AnimalShelter() animal.enqueue('bobi', 'dog') animal.enqueue('lara', 'cat') actual = [animal.dequeue('dog'), animal.dequeue('cat')] excepted = ['bobi', 'lara'] assert actual == excepted
def test_dequeue_2(): shelter = AnimalShelter(Queue(), Queue()) shelter.enqueue('cat') shelter.enqueue('cat') shelter.enqueue('dog') shelter.enqueue('dog') shelter.dequeue('cat') shelter.dequeue('cat') assert shelter.cats.front == None
def test_enqueue_many(): fas = AnimalShelter() fas.enqueue(Animal('cat', 'a')) fas.enqueue(Animal('cat', 'b')) fas.enqueue(Animal('cat', 'c')) assert fas.dequeue('cat').name == 'a' assert fas.dequeue('cat').name == 'b' assert fas.dequeue('cat').name == 'c' assert not fas.dequeue('cat')
def test_dequeue_from_shelter_another_animal(): ''' testing dequeue is handel returning another animal ''' shelter = AnimalShelter() cat1 = Cat('smoor') dog1 = Dog('toto') cat2 = Cat('tota') dog2 = Dog('smer') shelter.dequeue('hamster') assert shelter.dequeue('hamster') == None
def test_enqueue_cats_and_dogs(): shelter = AnimalShelter() shelter.enqueue('spike', 'dog') shelter.enqueue('sahsa', 'cat') shelter.enqueue('spike2', 'dog') shelter.enqueue('cherry', 'cat') shelter.dequeue() assert shelter.front.name == 'sahsa' # def test_enqueue_other_animals(): # shelter = AnimalShelter() # shelter.enqueue('bird') # assert shelter.front.value == ValueError
def test_dequeue_both(): fas = AnimalShelter() fas.enqueue(Animal('cat', 'a')) fas.enqueue(Animal('cat', 'b')) fas.enqueue(Animal('dog', 'c')) fas.enqueue(Animal('cat', 'd')) fas.enqueue(Animal('dog', 'e')) fas.enqueue(Animal('dog', 'f')) assert fas.dequeue('cat').name == 'a' assert fas.dequeue('dog').name == 'c' assert fas.dequeue('cat').name == 'b' assert fas.dequeue('dog').name == 'e' assert fas.dequeue('cat').name == 'd' assert fas.dequeue('dog').name == 'f' assert not fas.dequeue('cat')
def test_dogs_dequeue(): shelter = AnimalShelter() shelter.enqueue('rex', 'dog') shelter.enqueue('douglas', 'dog') actual = shelter.dequeue('dog') expected = 'rex' assert actual == expected
def test_no_animal_type_specified_for_dequeue(): shelter = AnimalShelter(Queue(), Queue()) shelter.enqueue('cat') shelter.enqueue('cat') shelter.enqueue('dog') shelter.enqueue('dog') assert shelter.dequeue() == None
def test_dequeue(): shelter = AnimalShelter(Queue(), Queue()) shelter.enqueue('cat') shelter.enqueue('cat') shelter.enqueue('dog') shelter.enqueue('dog') assert shelter.dequeue('dog') in shelter.dog_names
def test_dequeue_dog(): shelter1 = AnimalShelter('shelter1') dog1 = Dog('dog1') dog2 = Dog('dog2') shelter1.enqueue(dog1) shelter1.enqueue(dog2) assert shelter1.dequeue('dog').name == 'dog1'
def test_cats_dequeue(): shelter = AnimalShelter() shelter.enqueue('boufi', 'cat') shelter.enqueue('bia', 'cat') actual = shelter.dequeue('cat') expected = 'boufi' assert actual == expected
def test_enqueue_dequeue_cat_multiple(): as5 = AnimalShelter("The Cat Network") cat2 = Cat("Meow Capone") cat3 = Cat("Mathew Purrdrick") as5.enqueue(cat2) as5.enqueue(cat3) assert as5.dequeue("cat").name == "Meow Capone" assert as5.dequeue("cat").name == "Mathew Purrdrick"
def test_enqueue_dequeue_dog_multiple(): as3 = AnimalShelter("Save-a-Pet") dog3 = Dog("Stone Cold Steve Pawstin") dog4 = Dog("A dog with no name") as3.enqueue(dog3) as3.enqueue(dog4) assert as3.dequeue("dog").name == "Stone Cold Steve Pawstin" assert as3.dog_queue.peek().name == "A dog with no name"
def test_dequeue_from_shelter_dog_or_cat(): ''' testing dequeue is handel remove and return dogs or cats objects ''' shelter = AnimalShelter() cat1 = Cat('smoor') dog1 = Dog('toto') cat2 = Cat('tota') dog2 = Dog('smer') shelter.enqueue(cat1) shelter.enqueue(dog1) shelter.enqueue(cat2) shelter.enqueue(dog2) assert isinstance(shelter.dequeue('dog'), Dog) assert shelter.dequeue('cat') != None assert isinstance(shelter.dequeue('cat'), Cat) assert isinstance(shelter.dequeue('dog'), Dog)
def test_stretch_goal_oldest_animal(): as7 = AnimalShelter("Wags and Walks") dog8 = Dog("Anthony Walkin's") cat7 = Cat("Meowster Stallone") as7.enqueue(dog8) as7.enqueue(cat7) assert as7.dequeue().name == "Anthony Walkin's" assert as7.dequeue().name == "Meowster Stallone"
def test_dequeue_cat(): shelter1 = AnimalShelter('shelter1') cat1 = Cat('cat1') cat2 = Cat('cat2') cat3 = Cat('cat3') shelter1.enqueue(cat1) shelter1.enqueue(cat2) shelter1.enqueue(cat3) assert shelter1.dequeue('cat').name == 'cat1'
def test_when_not_the_special(): x = AnimalShelter() x.enqueue("cat") x.enqueue("dog") x.enqueue("cat") x.enqueue("cat") actual = x.dequeue("Tony") expected = "None" assert actual == expected
def test_all_functions(): as6 = AnimalShelter("Paws without Borders") dog5 = Dog("Tony Bark") dog6 = Dog("Steve Woofjers") dog7 = Dog("Natasha Roman-arf-a") cat4 = Cat("Clint Bartoffthecouch") cat5 = Cat("Mouse Banner") cat6 = Cat("Cat Danvers") as6.enqueue(dog5) as6.enqueue(cat4) as6.enqueue(dog6) as6.enqueue(cat5) as6.enqueue(dog7) as6.enqueue(cat6) assert as6.dequeue("cat") == cat4 assert as6.dequeue("cat") == cat5 assert as6.dequeue("dog") == dog5 assert as6.dequeue("dog") == dog6 assert as6.dequeue("cat") == cat6 assert as6.dequeue("dog") == dog7
def test_dequeue_cats_and_dogs(): shelter2 = AnimalShelter('shelter2') dog1 = Dog('dog1') cat1 = Cat('cat1') dog2 = Dog('dog2') cat2 = Cat('cat2') shelter2.enqueue(dog1) shelter2.enqueue(cat1) shelter2.enqueue(dog2) shelter2.enqueue(cat2) assert shelter2.dequeue('cat').name == 'cat1' assert shelter2.dequeue('dog').name == 'dog1'
def test_can_successfully_dequeue(): new_shelter = AnimalShelter() new_shelter.enqueue("dog") expected = "dog" actual = new_shelter.dequeue("dog") assert expected == actual
def test_dequeue_neither(): fas = AnimalShelter() fas.enqueue(Animal('cat', 'a')) fas.enqueue(Animal('parrot', 'b')) fas.enqueue(Animal('dog', 'c')) assert not fas.dequeue('parrot')
def test_enqueue_dequeue_cat(): as4 = AnimalShelter("Kitten Associates") cat1 = Cat("Senator Whiskers") as4.enqueue(cat1) assert as4.dequeue("cat").name == "Senator Whiskers"
def test_enqueue_one(): fas = AnimalShelter() fas.enqueue(Animal('cat', 'a')) assert fas.dequeue('cat').name == 'a'
def test_dequeue_fail(): animal = AnimalShelter() actual = animal.dequeue('horse') excepted = 'you can just choose dog or cat' assert actual == excepted
def test_new_type(): shelter = AnimalShelter() actual = shelter.dequeue('canary') expected = None assert actual == expected
def test_can_successfully_return_an_error_when_shelter_is_empty(): new_shelter = AnimalShelter() expected = "Null" actual = new_shelter.dequeue("dog") assert expected == actual
def test_dequeue(): x = AnimalShelter() x.enqueue("cat") actual = x.dequeue("cat") expected = "cat" assert actual == expected
def test_can_successfully_return_an_error_when_user_inputs_animal_other_than_cat_or_dog(): new_shelter = AnimalShelter() new_shelter.enqueue("dog") expected = "Null" actual = new_shelter.dequeue("lizard") assert expected == actual
def test_enqueue_dequeue_dog(): as2 = AnimalShelter("RedRover") dog2 = Dog("Sherlock Hounds") as2.enqueue(dog2) as2.dequeue("dog").name == "Sherlock Hounds"