示例#1
0
    def test_counts(self):
        """
        Test the OPML category counter and item iterator
        """
        opml = OPML(FEEDLY)
        expected = {
            'cooking': 4,
            'cinema': 3,
            'gaming': 3,
            'tech': 3,
            'essays': 2,
            'business': 3,
            'design': 2,
            'sports': 3,
            'books': 3,
            'data science': 4,
            'do it yourself': 2,
            'news': 2,
            'politics': 2,
        }
        counts = opml.counts()

        for key, val in expected.items():
            self.assertIn(key, counts)
            self.assertEqual(
                counts[key], val,
                "{} mismatch: {} vs {}".format(key, counts[key], val))
示例#2
0
    def test_counts(self):
        """
        Test the OPML category counter and item iterator
        """
        opml = OPML(FEEDLY)
        expected = {
            'cooking': 4,
            'cinema': 3,
            'gaming': 3,
            'tech': 3,
            'essays': 2,
            'business': 3,
            'design': 2,
            'sports': 3,
            'books': 3,
            'data science': 4,
            'do it yourself': 2,
            'news': 2,
            'politics': 2,
        }
        counts = opml.counts()

        for key, val in expected.items():
            self.assertIn(key, counts)
            self.assertEqual(
                counts[key], val,
                "{} mismatch: {} vs {}".format(key, counts[key], val)
            )
示例#3
0
    def test_categories(self):
        """
        Test the OPML categories listing
        """
        opml = OPML(FEEDLY)
        expected = [
            u'news', u'do it yourself', u'business', u'gaming',
            u'data science', u'essays', u'politics', u'tech', u'cinema',
            u'books', u'sports', u'cooking', u'design'
        ]

        print list(opml.categories())

        self.assertEqual(list(opml.categories()), expected)
示例#4
0
    def test_item_iterator_detail(self):
        """
        Test the XML result returned from OPML iteration
        """

        opml = OPML(FEEDLY)
        attrs = ['category', 'title', 'text', 'htmlUrl', 'xmlUrl', 'type']
        for item in opml:
            self.assertTrue(isinstance(item, dict))
            self.assertEqual(item.keys(), attrs)
示例#5
0
    def test_categories(self):
        """
        Test the OPML categories listing
        """
        opml = OPML(FEEDLY)
        expected = [
            u'news',
            u'do it yourself',
            u'business',
            u'gaming',
            u'data science',
            u'essays',
            u'politics',
            u'tech',
            u'cinema',
            u'books',
            u'sports',
            u'cooking',
            u'design'
        ]

        print(list(opml.categories()))

        self.assertEqual(list(opml.categories()), expected)
示例#6
0
 def __init__(self, path, **options):
     self.opml = OPML(path)
     super(OPMLIngestor, self).__init__(**options)
示例#7
0
 def test_length(self):
     """
     Test the OPML len built in
     """
     opml = OPML(FEEDLY)
     self.assertEqual(len(opml), 36)
示例#8
0
 def __init__(self, path):
     self.opml = OPML(path)