def test_head(self): fp = FeedPipe().cat(['tests/eg.xml']).head(2) a = fp.as_atom_obj() self.assertEqual(a.entries[0].title.text, 'Migrating My Blog from Linode to CloudFront') self.assertEqual(a.entries[1].title.text, 'UCSPI') self.assertEqual(fp.count(), 2)
def test_grep(self): fp = FeedPipe() \ .cat(['./tests/eg.xml']) \ .grep(lambda e: 'e' in e.title.text) a = fp.as_atom_obj() self.assertEqual(a.entries[0].title.text, 'Migrating My Blog from Linode to CloudFront') self.assertEqual(a.entries[1].title.text, 'Checking sudoers with visudo in SaltStack') self.assertEqual(fp.count(), 5)
def test_grep(self): fp = FeedPipe() \ .cat(['./tests/eg.xml']) \ .grep(lambda e: 'e' in e.title.text) a = fp.as_atom_obj() self.assertEqual( a.entries[0].title.text, 'Migrating My Blog from Linode to CloudFront' ) self.assertEqual( a.entries[1].title.text, 'Checking sudoers with visudo in SaltStack' ) self.assertEqual(fp.count(), 5)
def test_tail(self): fp = FeedPipe().cat(['tests/eg.xml']).tail(2) a = fp.as_atom_obj() self.assertEqual(a.entries[0].title.text, 'PID Namespaces in Linux') self.assertEqual(a.entries[1].title.text, 'Dream On Dreamer') self.assertEqual(fp.count(), 2)