def test_simple(self):
        f = wb.dictlinkfilter({'repo': 'http://myrepo.net'})

        self.assertNotSubstring('<a', f(None))
        self.assertSubstring('<a', f('repo'))
        self.assertNotSubstring('<a', f('repo2'))
        self.assertEquals(f('bah'), 'bah')  # passthrough
 def test_simple(self):
     f = wb.dictlinkfilter({'repo': 'http://myrepo.net'})
     
     self.assertNotSubstring('<a', f(None))
     self.assertSubstring('<a', f('repo'))
     self.assertNotSubstring('<a', f('repo2'))
     self.assertEquals(f('bah'), 'bah') # passthrough
    def test_callable(self):
        def my_dictlink(value):
            if len(value) == 0:
                return 'http://thevoid.net'
            if len(value) == 1:
                return 'http://highlander.net'
            if value == 'hiddenproject':
                return None
            else:
                return 'http://legion.net'

        f = wb.dictlinkfilter(my_dictlink)
        self.assertSubstring('thevoid', f(''))
        self.assertSubstring('highlander', f('X'))
        self.assertSubstring('legion', f('many'))
        self.assertSubstring('<a', f('many'))
        self.assertNotSubstring('<a', f('hiddenproject'))
 def test_callable(self):
     def my_dictlink(value):
         if len(value) == 0:
             return 'http://thevoid.net'
         if len(value) == 1:
             return 'http://highlander.net'
         if value == 'hiddenproject':
             return None
         else:
             return 'http://legion.net'
         
     f = wb.dictlinkfilter(my_dictlink)
     self.assertSubstring('thevoid', f(''))
     self.assertSubstring('highlander', f('X'))
     self.assertSubstring('legion', f('many'))
     self.assertSubstring('<a', f('many'))
     self.assertNotSubstring('<a', f('hiddenproject'))
    def test_default(self):
        f = wb.dictlinkfilter(None)

        self.assertNotSubstring('<a', f(None))
        self.assertNotSubstring('<a', f('repo'))
        self.assertNotSubstring('<a', f('repo2'))
 def test_default(self):
     f = wb.dictlinkfilter(None) 
     
     self.assertNotSubstring('<a', f(None))
     self.assertNotSubstring('<a', f('repo'))
     self.assertNotSubstring('<a', f('repo2'))