mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 04:32:36 +01:00
Revert a reply() change and fix some tests.
This commit is contained in:
parent
06e92cdcb2
commit
d8b7254021
@ -126,10 +126,11 @@ def reply(msg, s, prefixName=True, private=False,
|
||||
notice=False, to=None, action=False):
|
||||
# Ok, let's make the target:
|
||||
target = ircutils.replyTo(msg)
|
||||
if to is not None:
|
||||
target = to
|
||||
elif private:
|
||||
target = msg.nick
|
||||
if private:
|
||||
if to is not None:
|
||||
target = to
|
||||
else:
|
||||
target = msg.nick
|
||||
if to is None:
|
||||
to = msg.nick
|
||||
# Ok, now let's make the payload:
|
||||
|
@ -74,9 +74,9 @@ class TokenizerTestCase(SupyTestCase):
|
||||
['foo', 'bar baz', 'quux'])
|
||||
|
||||
def testNesting(self):
|
||||
orig = conf.supybot.bracketSyntax()
|
||||
orig = conf.supybot.reply.bracketSyntax()
|
||||
try:
|
||||
conf.supybot.bracketSyntax.setValue(True)
|
||||
conf.supybot.reply.bracketSyntax.setValue(True)
|
||||
self.assertEqual(tokenize('[]'), [[]])
|
||||
self.assertEqual(tokenize('[foo]'), [['foo']])
|
||||
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
||||
@ -84,16 +84,16 @@ class TokenizerTestCase(SupyTestCase):
|
||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||
['foo', 'bar', ['baz', 'quux']])
|
||||
finally:
|
||||
conf.supybot.bracketSyntax.setValue(orig)
|
||||
conf.supybot.reply.bracketSyntax.setValue(orig)
|
||||
try:
|
||||
conf.supybot.bracketSyntax.setValue(False)
|
||||
conf.supybot.reply.bracketSyntax.setValue(False)
|
||||
self.assertEqual(tokenize('[]'), ['[]'])
|
||||
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
||||
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||
['foo', 'bar', '[baz', 'quux]'])
|
||||
finally:
|
||||
conf.supybot.bracketSyntax.setValue(orig)
|
||||
conf.supybot.reply.bracketSyntax.setValue(orig)
|
||||
|
||||
def testError(self):
|
||||
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
||||
@ -101,7 +101,7 @@ class TokenizerTestCase(SupyTestCase):
|
||||
|
||||
def testPipe(self):
|
||||
try:
|
||||
conf.supybot.pipeSyntax.set('True')
|
||||
conf.supybot.reply.pipeSyntax.set('True')
|
||||
self.assertRaises(SyntaxError, tokenize, '| foo')
|
||||
self.assertRaises(SyntaxError, tokenize, 'foo ||bar')
|
||||
self.assertRaises(SyntaxError, tokenize, 'bar |')
|
||||
@ -116,7 +116,7 @@ class TokenizerTestCase(SupyTestCase):
|
||||
self.assertEqual(tokenize('foo bar | baz quux'),
|
||||
['baz', 'quux', ['foo', 'bar']])
|
||||
finally:
|
||||
conf.supybot.pipeSyntax.set('False')
|
||||
conf.supybot.reply.pipeSyntax.set('False')
|
||||
self.assertEqual(tokenize('foo|bar'), ['foo|bar'])
|
||||
self.assertEqual(tokenize('foo | bar'), ['foo', '|', 'bar'])
|
||||
self.assertEqual(tokenize('foo | bar | baz'),
|
||||
|
Loading…
Reference in New Issue
Block a user