def addMoreData(patients): results = [] meds = Medications() allergies = Allergies() for p in patients: m = meds.getMedications(p.PatientGuid) a = allergies.getAllergies(p.PatientGuid) p.addFeatures(m) p.addFeatures(a) results.append(p) return results
def test_allergic_to_eggs_and_peanuts(self): self.assertCountEqual(Allergies(3).lst, ['eggs', 'peanuts'])
def test_allergic_to_lots_of_stuff(self): self.assertCountEqual( Allergies(248).lst, ['strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats'])
def test_no_allergies_at_all(self): self.assertEqual(Allergies(0).lst, [])
def test_allergic_to_just_peanuts(self): self.assertEqual(Allergies(2).lst, ['peanuts'])
def test_no_allergies_means_not_allergic(self): allergies = Allergies(0) self.assertIs(allergies.is_allergic_to('peanuts'), False) self.assertIs(allergies.is_allergic_to('cats'), False) self.assertIs(allergies.is_allergic_to('strawberries'), False)
def test_allergic_to_eggs_in_addition_to_other_stuff(self): allergies = Allergies(5) self.assertIs(allergies.is_allergic_to('eggs'), True) self.assertIs(allergies.is_allergic_to('shellfish'), True) self.assertIs(allergies.is_allergic_to('strawberries'), False)
def test_allergic_only_to_chocolate(self): self.assertIs(Allergies(32).allergic_to("chocolate"), True)
def test_allergic_to_chocolate_and_something_else(self): self.assertIs(Allergies(112).allergic_to("chocolate"), True)
def test_tomatoes_allergic_to_everything(self): self.assertIs(Allergies(255).allergic_to("tomatoes"), True)
def test_chocolate_not_allergic_to_anything(self): self.assertIs(Allergies(0).allergic_to("chocolate"), False)
def test_allergic_to_something_but_not_tomatoes(self): self.assertIs(Allergies(40).allergic_to("tomatoes"), False)
def test_allergic_to_tomatoes_and_something_else(self): self.assertIs(Allergies(56).allergic_to("tomatoes"), True)
def test_allergic_only_to_tomatoes(self): self.assertIs(Allergies(16).allergic_to("tomatoes"), True)
def test_has_the_right_allergies(self): allergies = Allergies(5) self.assertTrue(allergies.is_allergic_to('eggs')) self.assertTrue(allergies.is_allergic_to('shellfish')) self.assertFalse(allergies.is_allergic_to('strawberries'))
def test_allergic_to_something_but_not_chocolate(self): self.assertIs(Allergies(80).allergic_to("chocolate"), False)
def test_tomatoes_not_allergic_to_anything(self): self.assertIs(Allergies(0).allergic_to("tomatoes"), False)
def test_chocolate_alergic_to_everything(self): self.assertIs(Allergies(255).allergic_to("chocolate"), True)
def test_is_allergic_to_eggs(self): self.assertIs(Allergies(1).is_allergic_to('eggs'), True)
def test_allergic_to_strawberries_but_not_peanuts(self): allergies = Allergies(9) self.assertIs(allergies.is_allergic_to('eggs'), True) self.assertIs(allergies.is_allergic_to('peanuts'), False) self.assertIs(allergies.is_allergic_to('shellfish'), False) self.assertIs(allergies.is_allergic_to('strawberries'), True)
def test_no_allergies_at_all(self): self.assertEqual([], Allergies(0).list)
def test_allergic_to_just_eggs(self): self.assertEqual(Allergies(1).lst, ['eggs'])
def test_allergic_to_just_peanuts(self): self.assertEqual(['peanuts'], Allergies(2).list)
def test_allergic_to_just_strawberries(self): self.assertEqual(Allergies(8).lst, ['strawberries'])
def test_allergic_to_everything(self): self.assertEqual(('eggs peanuts shellfish strawberries tomatoes ' 'chocolate pollen cats').split(), Allergies(255).list)
def test_allergic_to_more_than_eggs_but_not_peanuts(self): self.assertCountEqual(Allergies(5).lst, ['eggs', 'shellfish'])
def test_ignore_non_allergen_score_parts(self): self.assertEqual(['eggs'], Allergies(257).list)
def test_allergic_to_everything(self): self.assertCountEqual( Allergies(255).lst, [ 'eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats' ])
def test_ignore_non_allergen_score_parts_only_eggs(self): self.assertEqual(Allergies(257).lst, ['eggs'])
def test_ignore_non_allergen_score_parts(self): self.assertCountEqual( Allergies(509).lst, [ 'eggs', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats' ])
def test_no_allergies_means_not_allergic(self): allergies = Allergies(0) self.assertFalse(allergies.is_allergic_to('peanuts')) self.assertFalse(allergies.is_allergic_to('cats')) self.assertFalse(allergies.is_allergic_to('strawberries'))
def test_strawberries_allergic_to_everything(self): self.assertIs(Allergies(255).allergic_to("strawberries"), True)