Example #1
0
    def test_title_size2(self):
        
        expected_result1 = 'The cow'
        t1 = shorten_tweet_to_fit_url_and_tag(self.test_title_02, max_length=10, add_ellipsis=False)
        self.assertEqual(t1, expected_result1)

        #----------------------------------------------

        expected_result2 = 'The cow...'
        t2 = shorten_tweet_to_fit_url_and_tag(self.test_title_02, max_length=10, add_ellipsis=True)
        self.assertEqual(t2, expected_result2)
Example #2
0
    def test_title_size2(self):

        expected_result1 = 'The cow'
        t1 = shorten_tweet_to_fit_url_and_tag(self.test_title_02,
                                              max_length=10,
                                              add_ellipsis=False)
        self.assertEqual(t1, expected_result1)

        #----------------------------------------------

        expected_result2 = 'The cow...'
        t2 = shorten_tweet_to_fit_url_and_tag(self.test_title_02,
                                              max_length=10,
                                              add_ellipsis=True)
        self.assertEqual(t2, expected_result2)
Example #3
0
    def test_tweet_sizes(self):
        """
        Test title too long, should truncate it by chopping off words
        Tested with and without ellipsis add to end
        """
        expected_result1 = 'Next Week! Eva Nogales, HHMI Investigator: "High-Resolution Structures of Microtubules towards a Mechanistic Understanding of Dynamic'

        t1 = shorten_tweet_to_fit_url_and_tag(self.test_title_01, max_length=MAX_TWEET_LENGTH, add_ellipsis=False)
        self.assertEqual(t1, expected_result1)

        #----------------------------------------------
        # with 'add_ellipsis=True'

        expected_result2 = 'Next Week! Eva Nogales, HHMI Investigator: "High-Resolution Structures of Microtubules towards a Mechanistic Understanding of Dynamic...'
        t2 = shorten_tweet_to_fit_url_and_tag(self.test_title_01, max_length=MAX_TWEET_LENGTH, add_ellipsis=True)
        self.assertEqual(t2, expected_result2)
Example #4
0
    def test_tweet_sizes(self):
        """
        Test title too long, should truncate it by chopping off words
        Tested with and without ellipsis add to end
        """
        expected_result1 = 'Next Week! Eva Nogales, HHMI Investigator: "High-Resolution Structures of Microtubules towards a Mechanistic Understanding of Dynamic'

        t1 = shorten_tweet_to_fit_url_and_tag(self.test_title_01,
                                              max_length=MAX_TWEET_LENGTH,
                                              add_ellipsis=False)
        self.assertEqual(t1, expected_result1)

        #----------------------------------------------
        # with 'add_ellipsis=True'

        expected_result2 = 'Next Week! Eva Nogales, HHMI Investigator: "High-Resolution Structures of Microtubules towards a Mechanistic Understanding of Dynamic...'
        t2 = shorten_tweet_to_fit_url_and_tag(self.test_title_01,
                                              max_length=MAX_TWEET_LENGTH,
                                              add_ellipsis=True)
        self.assertEqual(t2, expected_result2)