コード例 #1
0
ファイル: test_papers.py プロジェクト: swillner/papers
 def isduplicate(a, b):
     """test Biblio's eq method for duplicates
     """
     db = bibtexparser.loads(a + '\n' + b)
     e1, e2 = db.entries
     refs = Biblio()
     return refs.eq(e1, e2)
コード例 #2
0
ファイル: test_papers.py プロジェクト: swillner/papers
 def isduplicate(self, a, b):
     """test Biblio's eq method for duplicates
     """
     db = bibtexparser.loads(a + '\n' + b)
     e1, e2 = db.entries
     refs = Biblio(similarity=self.similarity)
     return refs.eq(e1, e2)
コード例 #3
0
 def _checkbib(self, doi_only=False, dismiss_key=False):
     db1 = bibtexparser.load(open(self.mybib))
     self.assertTrue(len(db1.entries) > 0)
     file = db1.entries[0].pop('file').strip()
     db2 = bibtexparser.loads(self.bibtex)
     if doi_only:
         self.assertEqual([e['doi'] for e in db1.entries], [e['doi'] for e in db2.entries]) # entry is as expected
         # self.assertEqual([e['title'].lower() for e in db1.entries], [e['title'].lower() for e in db2.entries]) # entry is as expected
     elif dismiss_key:
         f = lambda e: {k:e[k] for k in e if k!='ID'}
         self.assertEqual([f(e) for e in db1.entries], [f(e) for e in db2.entries]) # entry is as expected
     else:
         self.assertEqual(db1.entries, db2.entries) # entry is as expected
     return file
コード例 #4
0
ファイル: test_papers.py プロジェクト: swillner/papers
 def test_fetch(self):
     bibtexs = run('papers fetch ' + self.doi).strip()
     db1 = bibtexparser.loads(bibtexs)
     db2 = bibtexparser.loads(self.bibtex)
     self.assertEqual(db1.entries, db2.entries)