mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +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):
|
notice=False, to=None, action=False):
|
||||||
# Ok, let's make the target:
|
# Ok, let's make the target:
|
||||||
target = ircutils.replyTo(msg)
|
target = ircutils.replyTo(msg)
|
||||||
if to is not None:
|
if private:
|
||||||
target = to
|
if to is not None:
|
||||||
elif private:
|
target = to
|
||||||
target = msg.nick
|
else:
|
||||||
|
target = msg.nick
|
||||||
if to is None:
|
if to is None:
|
||||||
to = msg.nick
|
to = msg.nick
|
||||||
# Ok, now let's make the payload:
|
# Ok, now let's make the payload:
|
||||||
|
@ -74,9 +74,9 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
['foo', 'bar baz', 'quux'])
|
['foo', 'bar baz', 'quux'])
|
||||||
|
|
||||||
def testNesting(self):
|
def testNesting(self):
|
||||||
orig = conf.supybot.bracketSyntax()
|
orig = conf.supybot.reply.bracketSyntax()
|
||||||
try:
|
try:
|
||||||
conf.supybot.bracketSyntax.setValue(True)
|
conf.supybot.reply.bracketSyntax.setValue(True)
|
||||||
self.assertEqual(tokenize('[]'), [[]])
|
self.assertEqual(tokenize('[]'), [[]])
|
||||||
self.assertEqual(tokenize('[foo]'), [['foo']])
|
self.assertEqual(tokenize('[foo]'), [['foo']])
|
||||||
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
||||||
@ -84,16 +84,16 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
['foo', 'bar', ['baz', 'quux']])
|
['foo', 'bar', ['baz', 'quux']])
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.bracketSyntax.setValue(orig)
|
conf.supybot.reply.bracketSyntax.setValue(orig)
|
||||||
try:
|
try:
|
||||||
conf.supybot.bracketSyntax.setValue(False)
|
conf.supybot.reply.bracketSyntax.setValue(False)
|
||||||
self.assertEqual(tokenize('[]'), ['[]'])
|
self.assertEqual(tokenize('[]'), ['[]'])
|
||||||
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
||||||
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
||||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
['foo', 'bar', '[baz', 'quux]'])
|
['foo', 'bar', '[baz', 'quux]'])
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.bracketSyntax.setValue(orig)
|
conf.supybot.reply.bracketSyntax.setValue(orig)
|
||||||
|
|
||||||
def testError(self):
|
def testError(self):
|
||||||
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
||||||
@ -101,7 +101,7 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
|
|
||||||
def testPipe(self):
|
def testPipe(self):
|
||||||
try:
|
try:
|
||||||
conf.supybot.pipeSyntax.set('True')
|
conf.supybot.reply.pipeSyntax.set('True')
|
||||||
self.assertRaises(SyntaxError, tokenize, '| foo')
|
self.assertRaises(SyntaxError, tokenize, '| foo')
|
||||||
self.assertRaises(SyntaxError, tokenize, 'foo ||bar')
|
self.assertRaises(SyntaxError, tokenize, 'foo ||bar')
|
||||||
self.assertRaises(SyntaxError, tokenize, 'bar |')
|
self.assertRaises(SyntaxError, tokenize, 'bar |')
|
||||||
@ -116,7 +116,7 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
self.assertEqual(tokenize('foo bar | baz quux'),
|
self.assertEqual(tokenize('foo bar | baz quux'),
|
||||||
['baz', 'quux', ['foo', 'bar']])
|
['baz', 'quux', ['foo', 'bar']])
|
||||||
finally:
|
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'), ['foo', '|', 'bar'])
|
self.assertEqual(tokenize('foo | bar'), ['foo', '|', 'bar'])
|
||||||
self.assertEqual(tokenize('foo | bar | baz'),
|
self.assertEqual(tokenize('foo | bar | baz'),
|
||||||
|
Loading…
Reference in New Issue
Block a user