def test_repopulate(self): self.cache.populate() set_metadata_cache(self.cache) self.cache.delete() self.cache.populate() title = get_metadata('title', 30929) self.assertIn('Het loterijbriefje', title)
def test_read_deleted_cache(self): self.cache.populate() set_metadata_cache(self.cache) self.cache.delete() try: get_metadata('title', 50405) except InvalidCacheException: pass
def test_read_unpopulated_cache(self): set_metadata_cache(self.cache) try: get_metadata('title', 50405) except InvalidCacheException: pass except: raise
def test_refresh(self): self.cache.populate() set_metadata_cache(self.cache) title = get_metadata('title', 30929) self.assertIn(u('Het loterijbriefje'), title) self.cache.refresh() title = get_metadata('title', 30929) self.assertIn(u('Het loterijbriefje'), title)
def tearDown(self): set_metadata_cache(None) self.cache.delete()
def setUp(self): self.cache = _SleepycatMetadataCacheForTesting(self.sample_data, 'nt') self.cache.populate() set_metadata_cache(self.cache)
def tearDown(self): set_metadata_cache(None) if self.cache.is_open: self.cache.delete() self.cache = None
def load_cache(): cache = SqliteMetadataCache('C:/Users/Laszlo/Desktop/Unshrederator2/cache/cache.sqlite') cache.populate() set_metadata_cache(cache)
return URIRef(value) class LanguageExtractor(_SimplePredicateRelationshipExtractor): """Extracts book languages. """ @classmethod def feature_name(cls): return 'language' @classmethod def predicate(cls): return DCTERMS.language / RDF.value @classmethod def contains(cls, value): return Literal(value) if __name__ == '__main__': from gutenberg.acquire.metadata import set_metadata_cache, SleepycatMetadataCache cache = SleepycatMetadataCache('/Users/deanjones/gutenberg_data') set_metadata_cache(cache) from gutenberg.query import get_etexts # texts = gutenberg.query.api.get_etexts('language', 'en') # print len(texts) print get_etexts('language', 'en')