def test_q_from_wikipedia_leftover_brackets_empty(self):
     wiki_page = utils.q_from_wikipedia("sv", "[[]]")
     result = None
     self.assertEqual(wiki_page, result)
 def test_q_from_wikipedia_linebreak(self):
     wiki_page = utils.q_from_wikipedia("sv", "Norrala\nsocken")
     result = "Q10602691"
     self.assertEqual(wiki_page, result)
 def test_q_from_wikipedia_leftover_brackets_pipe(self):
     wiki_page = utils.q_from_wikipedia("sv", "[[Pallaskatt|foo!]]")
     result = "Q166794"
     self.assertEqual(wiki_page, result)
 def test_q_from_wikipedia_disambig(self):
     wiki_page = utils.q_from_wikipedia("fi", "1 (täsmennyssivu)")
     self.assertIsNone(wiki_page)
 def test_q_from_wikipedia_missing_page(self):
     self.assertIsNone(
         utils.q_from_wikipedia("sv", "This page does not exist"))
 def test_q_from_wikipedia_not_mainspace(self):
     self.assertIsNone(utils.q_from_wikipedia("sv", "Användare:Vesihiisi"))
 def test_q_from_wikipedia_succeed(self):
     self.assertEqual(utils.q_from_wikipedia("sv", "Norrala socken"),
                      "Q10602691")