Exemplo n.º 1
0
 def test_throws_on_missing_site_id(self):
     with self.assertRaises(
             exceptions.MissingRequiredFieldXmlParseException):
         dtos.TaxonomyTerm(id='id',
                           name='name',
                           organization_id='organization_id',
                           description='description')
Exemplo n.º 2
0
 def test_throws_on_missing_name(self):
     with self.assertRaises(
             exceptions.MissingRequiredFieldXmlParseException):
         dtos.TaxonomyTerm(taxonomy_id='taxonomy_id')
Exemplo n.º 3
0
 def test_can_create(self):
     taxonomy_term = dtos.TaxonomyTerm(taxonomy_id='taxonomy_id',
                                       name='name')
     self.assertEqual(taxonomy_term.taxonomy_id, 'taxonomy_id')
     self.assertEqual(taxonomy_term.name, 'name')
Exemplo n.º 4
0
def parse_airs_taxonomy_term(code_str):
    taxonomy_id = 'airs'
    yield dtos.TaxonomyTerm(taxonomy_id=taxonomy_id, name=code_str)
Exemplo n.º 5
0
def parse_bc211_taxonomy_term(code_str):
    bc211_json_re = r"(\w+)\:\'([^\']+)\'"
    groups = re.findall(bc211_json_re, code_str)
    for (taxonomy_id, name) in groups:
        full_taxonomy_id = 'bc211-{}'.format(taxonomy_id)
        yield dtos.TaxonomyTerm(taxonomy_id=full_taxonomy_id, name=name)