コード例 #1
0
    def test_enrich_pubmed_accent_duplicate(self, *_):
        """Test when two authors, Gomez C and Goméz C are both checked that they are not counted as duplicates."""
        g1 = 'Gomez C'
        g2 = 'Gómez C'
        pmid_1, pmid_2 = pmids = [
            '29324713',
            '29359844',
        ]
        get_citations_by_pmids(manager=self.manager, pmids=pmids)

        time.sleep(1)

        x = self.manager.get_citation_by_pmid(pmid_1)
        self.assertIsNotNone(x)
        self.assertEqual('Martínez-Guillén JR',
                         x.first.name,
                         msg='wrong first author name')

        self.assertIn(g1, self.manager.object_cache_author)
        self.assertIn(g2, self.manager.object_cache_author)

        a1 = self.manager.get_author_by_name(g1)
        self.assertEqual(g1, a1.name)

        a2 = self.manager.get_author_by_name(g2)
        self.assertEqual(g2, a2.name)
コード例 #2
0
    def test_enrich(self):
        self.assertEqual(0, self.manager.count_citations())
        get_citations_by_pmids(manager=self.manager, pmids=[self.pmid])
        self.assertEqual(1, self.manager.count_citations())

        c = self.manager.get_citation_by_pmid(self.pmid)
        self.assertIsNotNone(c)
        self.assertIsInstance(c, Citation)
        self.assertEqual(CITATION_TYPE_PUBMED, c.db)
        self.assertEqual(self.pmid, c.db_id)
コード例 #3
0
    def test_enrich(self):
        pmids = get_pubmed_identifiers(self.graph)

        stored_citations = self.manager.session.query(Citation).all()

        self.assertEqual(0, len(stored_citations))

        get_citations_by_pmids(manager=self.manager, pmids=pmids)

        stored_citations = self.manager.session.query(Citation).all()
        self.assertEqual(1, len(stored_citations))
コード例 #4
0
    def test_enrich_list_grouped(self):
        pmids = [
            '25818332',
            '27003210',
            '26438529',
            '26649137',
        ]

        get_citations_by_pmids(manager=self.manager, pmids=pmids, group_size=2)

        citation = self.manager.get_citation_by_pmid('25818332')
        self.assertIsNotNone(citation)
コード例 #5
0
    def test_enrich_list(self):
        pmids = [
            '25818332',
            '27003210',
            '26438529',
            '26649137',
        ]

        get_citations_by_pmids(manager=self.manager, pmids=pmids)

        citation = self.manager.get_or_create_citation(type=CITATION_TYPE_PUBMED, reference='25818332')
        self.assertIsNotNone(citation)
コード例 #6
0
    def test_enrich_pubmed_list(self, *_):
        pmids = [
            '25818332',
            '27003210',
            '26438529',
            '26649137',
        ]

        get_citations_by_pmids(manager=self.manager, pmids=pmids)

        citation = self.manager.get_or_create_citation(
            namespace=CITATION_TYPE_PUBMED, identifier='25818332')
        self.assertIsNotNone(citation)
コード例 #7
0
    def test_accent_duplicate(self):
        """This tests when two authors, Gomez C and Goméz C are both checked that they are not counted as duplicates"""
        g1 = u'Gomez C'
        g2 = u'Gómez C'
        pmid_1, pmid_2 = pmids = [
            '29324713',
            '29359844',
        ]
        get_citations_by_pmids(manager=self.manager, pmids=pmids)

        x = self.manager.get_citation_by_pmid(pmid_1)
        self.assertEqual(u'Martínez-Guillén JR', x.first.name)

        self.assertIn(g1, self.manager.object_cache_author)
        self.assertIn(g2, self.manager.object_cache_author)

        a1 = self.manager.get_author_by_name(g1)
        self.assertEqual(g1, a1.name)

        a2 = self.manager.get_author_by_name(g2)
        self.assertEqual(g2, a2.name)