def test_to_dict(self): doc = BioDesDoc() doc.from_url(os.path.join(this_dir, 'bio.xml')) d = doc.to_dict() assert 'geboortedatum' in d, d assert doc.get_value('geboortedatum') self.assertEqual(type(doc.get_value('geboortedatum')), type(u''))
def test_get_value(self): doc = BioDesDoc() doc.from_url(os.path.join(this_dir, 'bio.xml')) value = [n.volledige_naam() for n in doc.get_value('namen')] should_be = ['C. van Heynsbergen'] self.failUnlessEqual(value, should_be)
def from_url(self, url): self.source_url = url BioDesDoc.from_url(self, url) self.create_id() return self