Exemplo n.º 1
0
 def testAuthor1(self):
     authorsIn = [
         "Rafed Muhammad Yasir", "Moumita Asad", "Aquib Azmain",
         "Eusha Kadir", "Kishan Kumar Ganguly"
     ]
     authorsOut = ["Yasir", "Asad", "Azmain", "Kadir", "Ganguly"]
     self.assertEqual(Util.lastNamify(authorsIn), authorsOut)
Exemplo n.º 2
0
    def _getAuthors(self, soup):
        for stuff in soup.findAll(True, {'class': 'gs_a'}):
            if "-" in stuff.text:
                string = stuff.text.split("-", 1)[0]
            else:
                string = stuff.text

            string = string.strip().replace('…', '')

            if "," in string:
                authors = [x.strip() for x in string.split(",")]
                authors = Util.lastNamify(authors)

                return authors
            else:
                if " " in string:
                    return string.split()[-1].strip()
                else:
                    return string

        return None
Exemplo n.º 3
0
 def testAuthor3(self):
     authorsIn = ["", "-P Ng", "KP Chiu", "L Lim", "T Zhang", "KP Chan"]
     authorsOut = ["Ng", "Chiu", "Lim", "Zhang", "Chan"]
     self.assertEqual(Util.lastNamify(authorsIn), authorsOut)
Exemplo n.º 4
0
 def testAuthor2(self):
     authorsIn = ["J Schäfer", "R Schoppe", "J Hölzl", "R Feder"]
     authorsOut = ["Schäfer", "Schoppe", "Hölzl", "Feder"]
     self.assertEqual(Util.lastNamify(authorsIn), authorsOut)