Beispiel #1
0
 def test_getLink_caching_maxLength(self):
     """Cache takes the 'maxLength' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertFalse(adapted.maxLength)
     self.assertTrue(u"<span class='pretty_link_content'>Folder</span>" in adapted.getLink())
     adapted.maxLength = 2
     self.assertFalse(u"<span class='pretty_link_content'>Folder</span>" in adapted.getLink())
     self.assertTrue(u"<span class='pretty_link_content'>Fo...</span>" in adapted.getLink())
Beispiel #2
0
 def test_getLink_caching_kwargs(self):
     """Cache takes the 'kwargs' parameter into account.
        By default it is used together with maxLength to define the ellipsis type."""
     adapted = IPrettyLink(self.folder)
     adapted.maxLength = 2
     self.assertFalse(adapted.kwargs)
     self.assertTrue(u"<span class='pretty_link_content'>Fo...</span>" in adapted.getLink())
     adapted.kwargs['ellipsis'] = ' [truncated]'
     self.assertFalse(u"<span class='pretty_link_content'>Fo...</span>" in adapted.getLink())
     self.assertTrue(u"<span class='pretty_link_content'>Fo [truncated]</span>" in adapted.getLink())
 def test_getLink_caching_maxLength(self):
     """Cache takes the 'maxLength' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertFalse(adapted.maxLength)
     self.assertTrue(
         u"<span class='pretty_link_content state-private'>Folder</span>" in
         adapted.getLink())
     adapted.maxLength = 2
     self.assertFalse(
         u"<span class='pretty_link_content state-private'>Folder</span>" in
         adapted.getLink())
     self.assertTrue(
         u"<span class='pretty_link_content state-private'>Fo...</span>" in
         adapted.getLink())
 def test_getLink_caching_kwargs(self):
     """Cache takes the 'kwargs' parameter into account.
        By default it is used together with maxLength to define the ellipsis type."""
     adapted = IPrettyLink(self.folder)
     adapted.maxLength = 2
     self.assertFalse(adapted.kwargs)
     self.assertTrue(
         u"<span class='pretty_link_content state-private'>Fo...</span>" in
         adapted.getLink())
     adapted.kwargs['ellipsis'] = ' [truncated]'
     self.assertFalse(
         u"<span class='pretty_link_content state-private'>Fo...</span>" in
         adapted.getLink())
     self.assertTrue(
         u"<span class='pretty_link_content state-private'>Fo [truncated]</span>"
         in adapted.getLink())