def test_AnimalShelter_enqueue_Exception(): with pytest.raises(Exception): shelter = AnimalShelter() cookie = Bird('Cookie') actual = shelter.enqueue(cookie) expected = 'We can only accept a cat or a dog.' assert actual == expected
def test_AnimalShelter_enqueue_Dog(): shelter = AnimalShelter() oliver = Dog('Oliver') shelter.enqueue(oliver) actual = str(shelter) expected = '[dog: Oliver] <- None' assert actual == expected
def test_AnimalShelter_enqueue_Dog(): shelter = AnimalShelter() oliver = Dog('Oliver') shelter.enqueue(oliver) actual = shelter.peek() expected = oliver assert actual == expected
def test_AnimalShelter_enqueue_Dog_Cat(): shelter = AnimalShelter() oliver = Dog('Oliver') cheeto = Cat('Cheeto') shelter.enqueue(oliver) shelter.enqueue(cheeto) actual = str(shelter) expected = '[dog: Oliver] <- [cat: Cheeto] <- None' assert actual == expected
def test_AnimalShelter_dequeue_pref_dog(): shelter = AnimalShelter() cheeto = Cat('Cheeto') oliver = Dog('Oliver') shelter.enqueue(cheeto) shelter.enqueue(oliver) actual = shelter.dequeue('dog') expected = 'cat' assert actual == expected
def test_AnimalShelter_dequeue_pref_not_catOrDog(): shelter = AnimalShelter() cheeto = Cat('Cheeto') oliver = Dog('Oliver') shelter.enqueue(cheeto) shelter.enqueue(oliver) actual = shelter.dequeue('bird') expected = None assert actual == expected
def test_AnimalShelter_enqueue_Cat(): shelter = AnimalShelter() cheeto = Cat('Cheeto') oliver = Dog('Oliver') shelter.enqueue(cheeto) shelter.enqueue(oliver) actual = shelter.peek() expected = cheeto assert actual == expected
def ash(): ash = AnimalShelter() ash.enqueue("dog", "Lucky") ash.enqueue("cat", "Queen") ash.enqueue("rabbit", "Jo") ash.enqueue("dog", "Happy") ash.enqueue("cat", "Jack") ash.enqueue("snake", "King") return ash
def test_AnimalShelter_dequeue_cat_first(): shelter = AnimalShelter() oliver = Dog('Oliver') cheeto = Cat('Cheeto') shelter.enqueue(cheeto) shelter.enqueue(oliver) actual = shelter.dequeque('cat') expected = 'Cheeto' assert actual == expected
def test_AnimalShelter_dequeue_dog_not_first(): shelter = AnimalShelter() oliver = Dog('Oliver') cheeto = Cat('Cheeto') sneakers = Cat('Sneakers') shelter.enqueue(cheeto) shelter.enqueue(sneakers) shelter.enqueue(oliver) actual = shelter.dequeque('dog') expected = 'Oliver' assert actual == expected
def test_animalshelter_instantiate_empty(): ash = AnimalShelter() actual = ash._dog_shelter.isEmpty() and ash._cat_shelter.isEmpty() and ash._others_shelter.isEmpty() expected = True assert actual == expected
def test_animalshelter_isEmpty_True(): ash = AnimalShelter() actual = ash.isEmpty() expected = True assert actual == expected
def test_animalshelter_import(): assert AnimalShelter()
def test_animalshelter_enqueue_other(): ash = AnimalShelter() ash.enqueue("rabbit", "Jo") actual = str(ash._others_shelter) expected = "{rabbit-Jo} -> NULL" assert actual == expected
def test_animalshelter_enqueue_cat(): ash = AnimalShelter() ash.enqueue("cat", "Queen") actual = str(ash._cat_shelter) expected = "{Queen} -> NULL" assert actual == expected
def test_AnimalShelter_enqueue_something(): shelter = AnimalShelter() shelter.enqueue('something') actual = shelter.peek() expected = 'something' assert actual == expected
def test_AnimalShelter_dequeue_alternating(): shelter = AnimalShelter() oliver = Dog('Oliver') cheeto = Cat('Cheeto') poncho = Dog('Poncho') sneakers = Cat('Sneakers') peso = Dog('Peso') shelter.enqueue(oliver) shelter.enqueue(poncho) shelter.enqueue(cheeto) shelter.enqueue(sneakers) shelter.enqueue(peso) actual = shelter.dequeque('cat') expected = 'Cheeto' assert actual == expected
def test_animalshelter_enqueue_dog(): ash = AnimalShelter() ash.enqueue("dog", "Lucky") actual = str(ash._dog_shelter) expected = "{Lucky} -> NULL" assert actual == expected