<commit_before>from unittest import TestCase

from feedparser import parse

from .mocks import good_atom, updated_atom

from ..utils import FeedComparator


class BaseComparatorTestCase(TestCase):
    old_parsed = parse(good_atom)
    new_parsed = parse(updated_atom)

    def setUp(self):
        self.compare = FeedComparator(self.new_parsed, self.old_parsed)

    def tearDown(self):
        self.compare = None


class TestFeedNew(BaseComparatorTestCase):

    def test_new_entries_length(self):
        new_entries = self.compare.new_entries()
        self.assertEqual(len(new_entries), 1)

    def test_new_entry_content(self):
        new_entries = self.compare.new_entries()
        self.assertEqual(new_entries[0]['title'], '<NAME>')


class TestFeedUpdated(BaseComparatorTestCase):

    def test_updated_entries_length(self):
        updated_entries = self.compare.updated_entries()
        self.assertEqual(len(updated_entries), 1)

    def test_updated_entry_content(self):
        updated_entries = self.compare.updated_entries()
        entry = updated_entries[0]
        self.assertEqual(entry['title'], 'Heathcliff')
        content = entry['content'][0]
        self.assertTrue('This entry was changed!' in content['value'])


class TestFeedRemoved(BaseComparatorTestCase):

    def test_removed_entries_length(self):
        removed_entries = self.compare.removed_entries()
        print removed_entries
        self.assertEqual(len(removed_entries), 1)<commit_msg>Add removal content test. Refs #573<commit_after>from unittest import TestCase

from feedparser import parse

from .mocks import good_atom, updated_atom

from ..utils import FeedComparator


class BaseComparatorTestCase(TestCase):
    old_parsed = parse(good_atom)
    new_parsed = parse(updated_atom)

    def setUp(self):
        self.compare = FeedComparator(self.new_parsed, self.old_parsed)

    def tearDown(self):
        self.compare = None


class TestFeedNew(BaseComparatorTestCase):

    def test_new_entries_length(self):
        new_entries = self.compare.new_entries()
        self.assertEqual(len(new_entries), 1)

    def test_new_entry_content(self):
        new_entries = self.compare.new_entries()
        self.assertEqual(new_entries[0]['title'], '<NAME>')


class TestFeedUpdated(BaseComparatorTestCase):

    def test_updated_entries_length(self):
        updated_entries = self.compare.updated_entries()
        self.assertEqual(len(updated_entries), 1)

    def test_updated_entry_content(self):
        updated_entries = self.compare.updated_entries()
        entry = updated_entries[0]
        self.assertEqual(entry['title'], 'Heathcliff')
        content = entry['content'][0]
        self.assertTrue('This entry was changed!' in content['value'])


class TestFeedRemoved(BaseComparatorTestCase):

    def test_removed_entries_length(self):
        removed_entries = self.compare.removed_entries()
        self.assertEqual(len(removed_entries), 1)

    def test_removed_entry_content(self):
        removed_entries = self.compare.removed_entries()
        self.assertTrue(removed_entries[0]['title'], 'Nermal')
{'fraction_non_alphanumeric': 0.09804549823774432, 'fraction_numerical': 0.00512656199935918, 'mean_word_length': 4.051779935275081, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6786135', 'n_tokens_mistral': 898, 'n_tokens_neox': 896, 'n_words': 168}