コード例 #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')
コード例 #2
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')
コード例 #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)
コード例 #6
0
    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)
コード例 #7
0
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]
コード例 #8
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)
コード例 #9
0
    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)
コード例 #10
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
コード例 #11
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
コード例 #12
0
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]
コード例 #13
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)
コード例 #14
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)
コード例 #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)
コード例 #16
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)
コード例 #17
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])
コード例 #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
コード例 #20
0
    def test_get_news_music_zip_longest(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        self.assertEqual(expected, actual)
コード例 #21
0
 def test_get_news_invalid_news_type(self):
     feed_reader = RssNewsFeedParser()
     with self.assertRaises(FeedReaderException):
         feed_reader.get_news('pluto')
コード例 #22
0
    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)
コード例 #23
0
    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)
コード例 #24
0
 def test_get_news_invalid_news_type(self):
     feed_reader = RssNewsFeedParser()
     with self.assertRaises(FeedReaderException):
         feed_reader.get_news('pluto')
コード例 #25
0
    def test_get_news_music_zip_longest(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        self.assertEqual(expected, actual)
コード例 #26
0
def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

    assert expected == actual
コード例 #27
0
def test_get_news_max_items_2():
    feed_reader = RssNewsFeedParser()

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

    assert expected[:2] == actual
コード例 #28
0
def test_get_news_invalid_news_type():
    feed_reader = RssNewsFeedParser()

    feed_reader.get_news('pluto')
コード例 #29
0
def test_get_news_invalid_news_type():
    feed_reader = RssNewsFeedParser()

    feed_reader.get_news('pluto')
コード例 #30
0
def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

    assert expected == actual