示例#1
0
    def test_get_query(self):
        header, body = split_header(self.test_text)
        q = get_query(parse_header(header))
        query = (u'(((Japan OR Fukushima) AND (Erdbeben OR nuklear OR Tsunami'
                 ' OR Krise\nOR Katastrophe OR Tepco)) '
                 ' AND date(geq(7/3/2011) AND leq(31/8/2011)) AND\n'
                 'pub(B\xf6rsen Zeitung OR  Frankfurter Rundschau OR  '
                 'taz OR  die tageszeitung))')
        self.assertEqual(q, query)

        header, body = split_header(self.test_text2)
        q = get_query(parse_header(header))
        self.assertIsNone(q)
示例#2
0
    def test_get_query(self):
        header, body = split_header(self.test_text)
        q = get_query(parse_header(header))
        query = (u'(((Japan OR Fukushima) AND (Erdbeben OR nuklear OR Tsunami'
                 ' OR Krise\nOR Katastrophe OR Tepco)) '
                 ' AND date(geq(7/3/2011) AND leq(31/8/2011)) AND\n'
                 'pub(B\xf6rsen Zeitung OR  Frankfurter Rundschau OR  '
                 'taz OR  die tageszeitung))')
        self.assertEqual(q, query)

        header, body = split_header(self.test_text2)
        q = get_query(parse_header(header))
        self.assertIsNone(q)
示例#3
0
    def test_parse_no_header(self):
        header, body = split_header(self.test_text2)
        header = header.replace(u'\ufeff', '').strip()
        self.assertFalse(bool(header))

        n_found = len(list(split_body(body)))
        self.assertEqual(n_found, 1)
示例#4
0
    def test_parse_no_header(self):
        header, body = split_header(self.test_text2)
        header = header.replace(u'\ufeff', '').strip()
        self.assertFalse(bool(header))

        n_found = len(list(split_body(body)))
        self.assertEqual(n_found, 1)
示例#5
0
 def split(self):
     return split_header(self.test_text)
示例#6
0
 def test_kop_as_headline(self):
     # Some lexis nexis files contain "KOP: " instaed of "HEADLINE: "
     header, body = split_header(self.test_text3)
     article = parse_article(next(split_body(body)))
     self.assertEqual("Gretta Duisenberg oprichtster van Palestina-groep",
                      article['title'])
示例#7
0
 def split(self):
     return split_header(self.test_text)
示例#8
0
 def test_kop_as_headline(self):
     # Some lexis nexis files contain "KOP: " instaed of "HEADLINE: "
     header, body = split_header(self.test_text3)
     article = body_to_article(*parse_article(next(split_body(body))))
     self.assertEqual("Gretta Duisenberg oprichtster van Palestina-groep", article.headline)