File: test_article.py

package info (click to toggle)
breadability 0.1.20-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 316 kB
  • ctags: 282
  • sloc: python: 1,713; makefile: 18
file content (33 lines) | stat: -rw-r--r-- 1,089 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf8 -*-

from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals

from os.path import join, dirname
from breadability.readable import Article
from ...compat import unittest


class TestSweetsharkBlog(unittest.TestCase):
    """
    Test the scoring and parsing of the article from URL below:
    http://sweetshark.livejournal.com/11564.html
    """

    def setUp(self):
        """Load up the article for us"""
        article_path = join(dirname(__file__), "article.html")
        with open(article_path, "rb") as file:
            self.document = Article(file.read(), "http://sweetshark.livejournal.com/11564.html")

    def tearDown(self):
        """Drop the article"""
        self.document = None

    def test_parses(self):
        """Verify we can parse the document."""
        self.assertIn('id="readabilityBody"', self.document.readable)

    def test_content_after_video(self):
        """The div with the comments should be removed."""
        self.assertIn('Stay hungry, Stay foolish', self.document.readable)