示例#1
0
 def test_has_authors(self):
     self.assertFalse(has_authors({}))
     self.assertFalse(has_authors({CITATION: {}}))
     self.assertFalse(has_authors({CITATION: {CITATION_AUTHORS: []}}))
     self.assertTrue(
         has_authors({CITATION: {
             CITATION_AUTHORS: ['One guy']
         }}))
示例#2
0
        def author_filter(data):
            """Only passes for edges with citations with an author that matches one or more of the contained authors

            :param dict data: The edge data dictionary
            :return: If the edge has a citation with an author that matches the the contained author
            :rtype: bool
            """
            return has_authors(data) and any(
                a in data[CITATION][CITATION_AUTHORS] for a in authors)