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_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_dogs_enqueue(): shelter = AnimalShelter() shelter.enqueue('rex', 'dog') shelter.enqueue('douglas', 'dog') actual = shelter.dogs.__str__() expected = ' rex -> douglas ->None' assert actual == expected
def test_cats_enqueue(): shelter = AnimalShelter() shelter.enqueue('boufi', 'cat') shelter.enqueue('bia', 'cat') actual = shelter.cats.__str__() expected = ' boufi -> bia ->None' assert actual == expected
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_cats_dequeue(): shelter = AnimalShelter() shelter.enqueue('boufi', 'cat') shelter.enqueue('bia', 'cat') actual = shelter.dequeue('cat') expected = 'boufi' assert actual == expected
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_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_enqueue_dog(): shelter1 = AnimalShelter('shelter1') dog1 = Dog('dog1') dog2 = Dog('dog2') shelter1.enqueue(dog1) shelter1.enqueue(dog2) assert shelter1
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_can_successfully_enqueue(): new_shelter = AnimalShelter() new_shelter.enqueue("dog") new_shelter.enqueue("dog") new_shelter.enqueue("cat") expected = "cat" actual = new_shelter.front.nodeVal assert expected == actual
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_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(): actual = [] animal = AnimalShelter() animal.enqueue('bobi', 'dog') actual += [animal.dog.peek()] animal.enqueue('lara', 'cat') actual += [animal.cat.peek()] 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_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_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_enqueue_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
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_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_adding_to_shelter(): ''' testing enqueue is working fine ''' shelter = AnimalShelter() cat1 = Cat('jojo') assert shelter.enqueue( cat1) != "You can't add other animal than dogs or cats"
def test_adding_to_shelter_multi_dogs_and_cats(): ''' testing enqueue is working fine with adding multi dogs and cats opjects ''' shelter = AnimalShelter() cat1 = Cat('smoor') cat2 = Cat('tota') dog1 = Dog('toto') dog2 = Dog('smer') assert shelter.enqueue( cat1) != "You can't add other animal than dogs or cats" assert shelter.enqueue( cat2) != "You can't add other animal than dogs or cats" assert shelter.enqueue( dog1) != "You can't add other animal than dogs or cats" assert shelter.enqueue( dog2) != "You can't add other animal than dogs or cats"
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_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_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_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_one(): fas = AnimalShelter() fas.enqueue(Animal('cat', 'a')) assert fas.dequeue('cat').name == 'a'
def test_animal_added(): dog = AnimalShelter() dog.enqueue("dog") actual = dog.first.value expected = "dog" assert actual == expected