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))
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) )
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)
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)
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)
def __init__(self, path, **options): self.opml = OPML(path) super(OPMLIngestor, self).__init__(**options)
def test_length(self): """ Test the OPML len built in """ opml = OPML(FEEDLY) self.assertEqual(len(opml), 36)
def __init__(self, path): self.opml = OPML(path)