예제 #1
0
    def test_truncate_no_length(self):

        text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
               u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
               u"consectetur adipiscing elit. In hac habitasse platea dictumst."

        truncated_text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
                         u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
                         u"consectetur adipiscing elit. In hac habitasse platea dictumst."

        from voteit.core.views.components.discussions import truncate

        self.assertEqual(truncate(text, None), (truncated_text, False))
예제 #2
0
    def test_truncate_no_length(self):
        
        text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
               u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
               u"consectetur adipiscing elit. In hac habitasse platea dictumst."
                
        truncated_text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
                         u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
                         u"consectetur adipiscing elit. In hac habitasse platea dictumst."

        from voteit.core.views.components.discussions import truncate
        
        self.assertEqual(truncate(text, None), (truncated_text, False))
예제 #3
0
    def test_truncate_long(self):

        text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
               u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
               u"consectetur adipiscing elit. In hac habitasse platea dictumst. " \
               u"Sed sit amet tortor at nisl malesuada tristique. Nulla faucibus " \
               u"egestas felis, at ullamcorper arcu sollicitudin amet."

        truncated_text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
                         u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
                         u"consectetur adipiscing elit. In hac habitasse platea dictumst. " \
                         u"Sed sit amet tortor at nisl malesuada tristique. Nulla fa…"

        from voteit.core.views.components.discussions import truncate

        self.assertEqual(truncate(text, 240), (truncated_text, True))
예제 #4
0
    def test_truncate_long(self):
        
        text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
               u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
               u"consectetur adipiscing elit. In hac habitasse platea dictumst. " \
               u"Sed sit amet tortor at nisl malesuada tristique. Nulla faucibus " \
               u"egestas felis, at ullamcorper arcu sollicitudin amet."
                
        truncated_text = u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
                         u"Nam luctus porta justo a pulvinar. Lorem ipsum dolor sit amet, " \
                         u"consectetur adipiscing elit. In hac habitasse platea dictumst. " \
                         u"Sed sit amet tortor at nisl malesuada tristique. Nulla fa…"

        from voteit.core.views.components.discussions import truncate
        
        self.assertEqual(truncate(text, 240), (truncated_text, True))