def test_collect_informations(monkeypatch): testPlace = Place("paris") def get_informations(*args, **kwargs): return "abc" monkeypatch.setattr(wikipedia, "summary", get_informations) testPlace.collect_informations() assert testPlace.informations == "abc"
def test_collect_localisation(monkeypatch): testPlace = Place("paris") def get_localisation(*args, **kwargs): return LocalisationResponse() monkeypatch.setattr(requests, "get", get_localisation) testPlace.collect_localisation("fakeApiKey") assert testPlace.address == "13 rue du test"
def create_gyms(self): no_agents = 2 * self.no_homes currently_created = 0 while currently_created < no_agents: capacity = random.randint(20, 70) self.gyms.append( Place('gym', capacity, 6, 23, self.contamination_length)) currently_created += capacity
def create_schools(self): no_agents = 2 * self.no_homes currently_created = 0 while currently_created < no_agents: capacity = random.randint(200, 400) self.schools.append( Place('school', capacity, 7, 16, self.contamination_length)) currently_created += capacity
def create_meeting_places(self): no_agents = 2 * self.no_homes currently_created = 0 while currently_created < no_agents: capacity = random.randint(20, 70) self.meeting_places.append( Place('meeting places', capacity, 11, 19, self.contamination_length)) currently_created += capacity
def create_shopping_centres(self): no_agents = 2 * self.no_homes currently_created = 0 while currently_created < no_agents: capacity = random.randint(100, 400) self.shopping_centres.append( Place('shopping centre', capacity, 10, 22, self.contamination_length)) currently_created += capacity
def create_work_places(self): no_agents = 2 * self.no_homes currently_created = 0 while currently_created < no_agents: capacity = random.randint(60, 100) open_from = random.randint(6, 10) self.work_places.append( Place('work place', capacity, open_from, open_from + 12, self.contamination_length)) currently_created += capacity
def create_homes(self): for _ in range(self.no_homes): self.homes.append(Place('home', 4, 0, 0, self.contamination_length))