def test_store(self): pmid=18297132 pubmed=Pubmed(pmid) self.assertEqual(pubmed.pubmed_id, pmid) try: os.unlink(pubmed.path()) except OSError: pass pubmed.fetch() self.assertTrue(os.access(pubmed.path(), os.R_OK)) self.assertEqual(os.path.getsize(pubmed.path()), 17990)
def test_store(self): pmid = 18297132 pubmed = Pubmed(pmid) self.assertEqual(pubmed.pubmed_id, pmid) try: os.unlink(pubmed.path()) except OSError: pass pubmed.fetch() self.assertTrue(os.access(pubmed.path(), os.R_OK)) self.assertEqual(os.path.getsize(pubmed.path()), 17990)
def test_store(self): warn("\n") pmid=18297132 pubmed=Pubmed(pmid) self.assertIsInstance(pubmed, Pubmed) self.assertEqual(pubmed.pubmed_id, pmid) pubmed.remove() pubmed.store() self.assertTrue(os.access(pubmed.path(), os.R_OK)) cursor=Pubmed.mongo().find({'pubmed_id':pmid}) self.assertEqual(cursor.count(), len(Pubmed.text_tags)) tag2count={'MeshHeading':22, 'AbstractText':247, 'ArticleTitle':15} for record in cursor: tag=record['tag'] self.assertEqual(len(record['words']), tag2count[tag])
def test_store(self): warn("\n") pmid = 18297132 pubmed = Pubmed(pmid) self.assertIsInstance(pubmed, Pubmed) self.assertEqual(pubmed.pubmed_id, pmid) pubmed.remove() pubmed.store() self.assertTrue(os.access(pubmed.path(), os.R_OK)) cursor = Pubmed.mongo().find({'pubmed_id': pmid}) self.assertEqual(cursor.count(), len(Pubmed.text_tags)) tag2count = { 'MeshHeading': 22, 'AbstractText': 247, 'ArticleTitle': 15 } for record in cursor: tag = record['tag'] self.assertEqual(len(record['words']), tag2count[tag])