mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Case-insensitivity for Math.calc.
This commit is contained in:
parent
001d8439c3
commit
c2399ec881
@ -186,7 +186,7 @@ class Math(callbacks.Privmsg):
|
||||
if 'lambda' in text:
|
||||
irc.error('You can\'t use lambda in this command.')
|
||||
return
|
||||
text = text.replace('lambda', '') # Let's leave it in for safety.
|
||||
text = text.lower()
|
||||
def handleMatch(m):
|
||||
s = m.group(1)
|
||||
if s.startswith('0x'):
|
||||
|
@ -112,11 +112,6 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertNotError('calc 3-2*4')
|
||||
self.assertNotError('calc (1600 * 1200)-2*(1024*1280)')
|
||||
|
||||
def testICalc(self):
|
||||
self.assertResponse('icalc 1^1', '0')
|
||||
self.assertResponse('icalc 10**24', '1' + '0'*24)
|
||||
self.assertRegexp('icalc 49/6', '8.16')
|
||||
|
||||
def testCalcNoNameError(self):
|
||||
self.assertNotRegexp('calc foobar(x)', 'NameError')
|
||||
|
||||
@ -126,6 +121,14 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
||||
def testCalcFloorWorksWithSqrt(self):
|
||||
self.assertNotError('calc floor(sqrt(5))')
|
||||
|
||||
def testCaseInsensitive(self):
|
||||
self.assertNotError('calc PI**PI')
|
||||
|
||||
def testICalc(self):
|
||||
self.assertResponse('icalc 1^1', '0')
|
||||
self.assertResponse('icalc 10**24', '1' + '0'*24)
|
||||
self.assertRegexp('icalc 49/6', '8.16')
|
||||
|
||||
def testRpn(self):
|
||||
self.assertResponse('rpn 5 2 +', '7')
|
||||
self.assertResponse('rpn 1 2 3 +', 'Stack: [1, 5]')
|
||||
|
Loading…
Reference in New Issue
Block a user