Ejemplo n.º 1
0
def setup():
    the_kennel = Kennel()
    """
    BMC   Brad    McCaw   12/13/1982
    RTH   Richie  Thorn   8/05/1980
    DEL   Dan     Ellis   16/02/1984
    ACR   Andrew  Carter  30/11/1987
    """
    # ADD CODE HERE TO CREATE THE OWNERS
    the_kennel.add_owner('BMC', 'Brad', 'McCaw', date(1982, 11, 12))
    the_kennel.add_owner('RTH', 'Richie', 'Thorn', date(1980, 4, 8))
    the_kennel.add_owner('DEL', 'Dan', 'Ellis', date(1984, 1, 16))
    the_kennel.add_owner('ACR', 'Andrew', 'Carter', date(1987, 10, 30))
    """    
    DogOwner ID     Name         Breed         Gender      Favorite Food
      BMC          Speedy     Pomeranian        N           Ekanuba
      RTH          Victor      Beagle           M           Chef
      RTH          Killer      Mastiff          N           Purina
      DEL          Ruftero     Poodle           F           Ekanuba
      DEL          Sausage    Dachshund         F           Purina
      ACR          Random      Mastiff          F            Cat
    """
    # ADD CODE HERE TO CREATE THE DOGS

    return the_kennel
Ejemplo n.º 2
0
 def test_g_add_dog_increases_dog_count(self):
     kennel = Kennel()
     owner = Owner('1', 'A', 'B', 2, kennel)
     owner.add_dog('name1', 'breed1', 'gender1', 'favorite_food1')
     assert len(owner.all_my_dogs) == 1
     owner.add_dog('name2', 'breed2', 'gender2', 'favorite_food2')
     assert len(owner.all_my_dogs) == 2
 def test_d_has_one_dog_returns_false_with_2_dogs(self):
     kennel = Kennel()
     owner = Owner('id', 'first_name', 'last_name', 'birth_date', kennel)
     owner.add_dog('name1', 'breed1', 'gender1', 'favorite_food1')
     owner.add_dog('name2', 'breed2', 'gender2', 'favorite_food2')
     returned = owner.has_one_dog()
     assert returned == False
 def test_a_owner_properties(self):
     kennel = Kennel()
     owner = Owner('1', 'A', 'B', 2, kennel)
     assert hasattr(owner, 'id')
     assert hasattr(owner, 'first_name')
     assert hasattr(owner, 'last_name')
     assert hasattr(owner, 'birth_date')
     assert hasattr(owner, 'my_kennel')
     assert hasattr(owner, 'all_my_dogs')
     assert type(owner.all_my_dogs) == list
Ejemplo n.º 5
0
 def test_e_kennel_get_those_with_one_dog_not_hard_coded(self):
     kennel = Kennel()
     returned = kennel.get_those_with_one_dog()
     assert len(returned) == 0
Ejemplo n.º 6
0
 def test_d_kennel_get_those_with_many_dogs_returns_string(self):
     kennel = Kennel()
     returned = kennel.get_those_with_one_dog()
     assert isinstance(returned, str)
Ejemplo n.º 7
0
 def test_c_kennel_get_those_with_many_dogs_exists(self):
     kennel = Kennel()
     assert hasattr(kennel, 'get_those_with_one_dog')
     assert callable(getattr(kennel, 'get_those_with_one_dog', None))
 def test_a_owner_has_one_dog_exists(self):
     kennel = Kennel()
     owner = Owner('id', 'first_name', 'last_name', 'birth_date', kennel)
     assert hasattr(owner, 'has_one_dog')
     assert callable(getattr(owner, 'has_one_dog', None))
 def test_c_has_one_dog_returns_true_with_1_dog(self):
     kennel = Kennel()
     owner = Owner('id', 'first_name', 'last_name', 'birth_date', kennel)
     owner.add_dog('name1', 'breed1', 'gender1', 'favorite_food1')
     returned = owner.has_one_dog()
     assert returned == True
Ejemplo n.º 10
0
 def test_b_kennel_add_owner(self):
     kennel = Kennel()
     assert hasattr(kennel, 'add_owner')
     assert callable(getattr(kennel, 'add_owner', None))
Ejemplo n.º 11
0
 def set_data(self):
     kennel = Kennel()
     owner = Owner(1, 'A', 'B', 2, kennel)
     return owner
Ejemplo n.º 12
0
 def test_a_kennel_collection(self):
     kennel = Kennel()
     assert hasattr(kennel, 'all_my_owners')
     assert type(kennel.all_my_owners) == list
Ejemplo n.º 13
0
 def test_b_owner_methods(self):
     kennel = Kennel()
     owner = Owner('1', 'A', 'B', 2, kennel)
     assert hasattr(owner, 'sort_dogs')
     assert callable(getattr(owner, 'sort_dogs', None))
Ejemplo n.º 14
0
 def test_d_kennel_sort_owners(self):
     kennel = Kennel()
     assert hasattr(kennel, 'sort_owners')
     assert callable(getattr(kennel, 'sort_owners', None))
Ejemplo n.º 15
0
 def test_c_kennel_find_owner(self):
     kennel = Kennel()
     assert hasattr(kennel, 'find_owner')
     assert callable(getattr(kennel, 'find_owner', None))
Ejemplo n.º 16
0
 def test_f_owner_add_dog_exists(self):
     kennel = Kennel()
     owner = Owner('1', 'A', 'B', 2, kennel)
     assert hasattr(owner, 'add_dog')
     assert callable(getattr(owner, 'add_dog', None))
Ejemplo n.º 17
0
 def test_b_has_one_dog_returns_false_with_0_dogs(self):
     kennel = Kennel()
     owner = Owner('id', 'first_name', 'last_name', 'birth_date', kennel)
     returned = owner.has_one_dog()
     assert returned == False
Ejemplo n.º 18
0
from poodle import Poodle
from kennel import Kennel
from namegen import generate_name
from random import randint, choice
from time import sleep

patriarch = Poodle(gender='male')
matriarch = Poodle(gender='female')
doghouse = Kennel(2, [matriarch], [patriarch])
print(doghouse)

for i in range(15):
    sleep(randint(2, 5))
    doghouse.grow()
    print('')

sleep(3)
print('')
print(doghouse.census())
print(doghouse)
 def set_data(self):
     kennel = Kennel()
     owner = Owner('id', 'first_name', 'last_name', 'birth_date', kennel)
     return owner