示例#1
0
    def test_get_news_invalid_news_type(self):
        # TODO: in the test_get_news_invalid_news_type method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO: Call an assert method to verify that if you call the
        # feed reader's get_news() method with an invalid news type argument
        # (for example, 'pluto'), the method raises a FeedReaderException.
        with self.assertRaises(FeedReaderException):
            feed_reader.get_news('pluto')
    def test_get_news_invalid_news_type(self):
        # TODO: in the test_get_news_invalid_news_type method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO: Call an assert method to verify that if you call the
        # feed reader's get_news() method with an invalid news type argument
        # (for example, 'pluto'), the method raises a FeedReaderException.
        with self.assertRaises(FeedReaderException):
            feed_reader.get_news('pluto')
示例#3
0
def test_get_news_max_items_2():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music', max_items=2)

    for expected_result, actual_result in zip_longest(expected[:2], actual):
        assert expected_result == actual_result
示例#4
0
def test_get_news_music():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music')

    for expected_result, actual_result in zip_longest(expected, actual):
        assert expected_result == actual_result
示例#5
0
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        for expected_result, actual_result in zip_longest(expected[:2], actual):
            self.assertEquals(expected_result, actual_result)
    def test_get_news_music(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        for expected_result, actual_result in zip_longest(expected, actual):
            self.assertEquals(expected_result, actual_result)
def test_get_news_music_max_items_1():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=1)

    assert 1 == len(actual)
    assert expected[0] == actual[0]
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        for expected_result, actual_result in zip_longest(expected[:2], actual):
            self.assertEquals(expected_result, actual_result)
    def test_get_news_music(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        for expected_result, actual_result in zip_longest(expected, actual):
            self.assertEquals(expected_result, actual_result)
def test_get_news_music():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music')

    for expected_result, actual_result in zip_longest(expected, actual):
        assert expected_result == actual_result
def test_get_news_max_items_2():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music', max_items=2)

    for expected_result, actual_result in zip_longest(expected[:2], actual):
        assert expected_result == actual_result
def test_get_news_music_max_items_1():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=1)

    assert 1 == len(actual)
    assert expected[0] == actual[0]
    def test_get_news_max_items_1(self):
        feed_reader = RssNewsFeedParser()

        # Note the call FeedReader.get_news() with a max_items argument
        actual = feed_reader.get_news('music', max_items=1)

        # Note the use of list slicing in the following assertion to verify
        # that the actual returned list contains only one item.
        self.assertEqual(expected[:1], actual)
    def test_get_news_max_items_1(self):
        feed_reader = RssNewsFeedParser()

        # Note the call FeedReader.get_news() with a max_items argument
        actual = feed_reader.get_news('music', max_items=1)

        # Note the use of list slicing in the following assertion to verify
        # that the actual returned list contains only one item.
        self.assertEqual(expected[:1], actual)
示例#15
0
    def test_get_news_music(self):
        # TODO: in the test_get_news_music method, create an instance of
        # RssNewsFeedParser and save a reference to it in a local variable
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing 'music' as the
        #    argument
        # 2. save the list returned by the method in a local variable
        #    named `actual`
        actual = feed_reader.get_news('music')

        # TODO: call a method that asserts the list named `expected` is
        # equal to the list named `actual`
        self.assertEqual(expected, actual)
    def test_get_news_music(self):
        # TODO: in the test_get_news_music method, create an instance of
        # RssNewsFeedParser and save a reference to it in a local variable
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing 'music' as the
        #    argument
        # 2. save the list returned by the method in a local variable
        #    named `actual`
        actual = feed_reader.get_news('music')

        # TODO: call a method that asserts the list named `expected` is
        # equal to the list named `actual`
        self.assertEqual(expected, actual)
    def test_get_news_music_max_items_1(self):
        # TODO: in the test_get_news_music_max_items_1 method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing
        #    news_type='music' and max_items=1 as the arguments.
        # 2. save the list returned by the method in a local variable
        actual = feed_reader.get_news('music', max_items=1)

        # TODO: call a method that asserts the returned list has length 1
        self.assertEqual(1, len(actual))

        # TODO: verify that the first item of the `expected` list equals the 
        # first item of the returned list.
        self.assertEqual(expected[0], actual[0])
示例#18
0
    def test_get_news_music_max_items_1(self):
        # TODO: in the test_get_news_music_max_items_1 method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing
        #    news_type='music' and max_items=1 as the arguments.
        # 2. save the list returned by the method in a local variable
        actual = feed_reader.get_news('music', max_items=1)

        # TODO: call a method that asserts the returned list has length 1
        self.assertEqual(1, len(actual))

        # TODO: verify that the first item of the `expected` list equals the
        # first item of the returned list.
        self.assertEqual(expected[0], actual[0])
示例#19
0
def test_get_news_max_items_2():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=2)

    assert expected[:2] == actual
    def test_get_news_music_zip_longest(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        self.assertEqual(expected, actual)
 def test_get_news_invalid_news_type(self):
     feed_reader = RssNewsFeedParser()
     with self.assertRaises(FeedReaderException):
         feed_reader.get_news('pluto')
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        self.assertEqual(expected[:2], actual)
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        self.assertEqual(expected[:2], actual)
 def test_get_news_invalid_news_type(self):
     feed_reader = RssNewsFeedParser()
     with self.assertRaises(FeedReaderException):
         feed_reader.get_news('pluto')
    def test_get_news_music_zip_longest(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        self.assertEqual(expected, actual)
def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

    assert expected == actual
def test_get_news_max_items_2():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=2)

    assert expected[:2] == actual
def test_get_news_invalid_news_type():
    feed_reader = RssNewsFeedParser()

    feed_reader.get_news('pluto')
def test_get_news_invalid_news_type():
    feed_reader = RssNewsFeedParser()

    feed_reader.get_news('pluto')
def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

    assert expected == actual