mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Fixed bug with channel capabilities for channels with . in their name.
This commit is contained in:
parent
1ac029a54c
commit
e75b92853b
@ -46,7 +46,8 @@ def fromChannelCapability(capability):
|
||||
"""Returns a (channel, capability) tuple from a channel capability."""
|
||||
if not isChannelCapability(capability):
|
||||
raise ValueError, '%s is not a channel capability' % capability
|
||||
return capability.split('.', 1)
|
||||
#return capability.rsplit('.', 1)
|
||||
return rsplit(capability, '.', 1)
|
||||
|
||||
def isChannelCapability(capability):
|
||||
"""Returns True if capability is a channel capability; False otherwise."""
|
||||
|
@ -45,10 +45,12 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
self.failIf(ircdb.isAntiCapability('#foo.bar'))
|
||||
self.failUnless(ircdb.isAntiCapability('!foo'))
|
||||
self.failUnless(ircdb.isAntiCapability('#foo.!bar'))
|
||||
self.failUnless(ircdb.isAntiCapability('#foo.bar.!baz'))
|
||||
|
||||
def testIsChannelCapability(self):
|
||||
self.failIf(ircdb.isChannelCapability('foo'))
|
||||
self.failUnless(ircdb.isChannelCapability('#foo.bar'))
|
||||
self.failUnless(ircdb.isChannelCapability('#foo.bar.baz'))
|
||||
|
||||
def testMakeAntiCapability(self):
|
||||
self.assertEqual(ircdb.makeAntiCapability('foo'), '!foo')
|
||||
@ -58,9 +60,17 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
self.assertEqual(ircdb.makeChannelCapability('#f', 'b'), '#f.b')
|
||||
self.assertEqual(ircdb.makeChannelCapability('#f', '!b'), '#f.!b')
|
||||
|
||||
def testFromChannelCapability(self):
|
||||
self.assertEqual(ircdb.fromChannelCapability('#foo.bar'),
|
||||
['#foo', 'bar'])
|
||||
self.assertEqual(ircdb.fromChannelCapability('#foo.bar.baz'),
|
||||
['#foo.bar', 'baz'])
|
||||
|
||||
def testUnAntiCapability(self):
|
||||
self.assertEqual(ircdb.unAntiCapability('!bar'), 'bar')
|
||||
self.assertEqual(ircdb.unAntiCapability('#foo.!bar'), '#foo.bar')
|
||||
self.assertEqual(ircdb.unAntiCapability('#foo.bar.!baz'),
|
||||
'#foo.bar.baz')
|
||||
|
||||
def testInvertCapability(self):
|
||||
self.assertEqual(ircdb.invertCapability('bar'), '!bar')
|
||||
|
Loading…
Reference in New Issue
Block a user