def test_build_catalyst_xml_match_example(self): xml = """ <FindPMIDs> <Name> <First>Griffin</First> <Last>Weber</Last> </Name> <EmailList> <email>[email protected]</email> </EmailList> <AffiliationList> <Affiliation>%Brigham%Women%</Affiliation> <Affiliation>%@hms.harvard.edu%</Affiliation> </AffiliationList> <LocalDuplicateNames>1</LocalDuplicateNames> <RequireFirstName>false</RequireFirstName> <MatchThreshold>0.98</MatchThreshold> <PMIDAddList> <PMID>11707567</PMID> </PMIDAddList> <PMIDExcludeList> <PMID>19648504</PMID> </PMIDExcludeList> </FindPMIDs> """.strip().replace('\n', '').replace('\t', '').replace(' ', '') xml = ET.fromstring(xml) xml = ET.tostring(xml) actual_xml = catalyst.build_catalyst_xml( Person('1', 'Griffin', 'Weber', 'Griffin Webber', '*****@*****.**', '1234567'), ['Brigham%Women', '@hms.harvard.edu'], ['11707567'], ['19648504']) self.assertEqual(xml, actual_xml)
def get_people(sup_cur: db.Cursor) -> Dict[int, Person]: print("Gathering People") people: Dict[int, Person] = {} records = db.get_people(sup_cur) for pid, (first, last, display, email, phone, withheld, overview) in records.items(): person = Person(person_id=str(pid), first_name=first, last_name=last, display_name=display, email=email, phone=phone, withheld=withheld, overview=overview) people[pid] = person print(f"There are {len(people)} people.") return people
def test_build_catalyst_xml_empty_exclude(self): try: catalyst.build_catalyst_xml( Person('1', 'f', 'l', 'd', 'e', 'p'), ['a'], ['1'], []) except Exception: self.fail('Empty exclude list caused exception')
def test_build_catalyst_xml_none_exclude(self): try: catalyst.build_catalyst_xml( Person('1', 'f', 'l', 'd', 'e', 'p'), ['a'], ['1'], None) except Exception: self.fail('None exclude list caused exception')
def test_build_catalyst_xml_empty_include(self): with self.assertRaises(AssertionError): catalyst.build_catalyst_xml( Person('1', 'f', 'l', 'd', 'e', 'p'), ['a'], [], ['2'])
def test_build_catalyst_xml_none_affiliations(self): with self.assertRaises(AssertionError): catalyst.build_catalyst_xml( Person('1', 'f', 'l', 'd', 'e', 'p'), None, ['1'], ['2'])