Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
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
Exemplo n.º 3
0
 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')
Exemplo n.º 4
0
 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')
Exemplo n.º 5
0
 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'])
Exemplo n.º 6
0
 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'])