mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-10-14 17:59:29 +02:00
Don't respond with the units so as to ease nesting convert and calc
This commit is contained in:
parent
212da17352
commit
e31aa252dd
@ -328,7 +328,7 @@ class Math(callbacks.Privmsg):
|
|||||||
newNum = convertcore.convert(num, unit1, unit2)
|
newNum = convertcore.convert(num, unit1, unit2)
|
||||||
newNum = self._floatToString(newNum)
|
newNum = self._floatToString(newNum)
|
||||||
|
|
||||||
irc.reply('%s %s' % (newNum , unit2))
|
irc.reply('%s' % newNum)
|
||||||
except convertcore.UnitDataError, ude:
|
except convertcore.UnitDataError, ude:
|
||||||
irc.error(str(ude))
|
irc.error(str(ude))
|
||||||
|
|
||||||
|
@ -140,15 +140,15 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
self.assertNotRegexp('rpn 2 3 foobar', 'SyntaxError')
|
self.assertNotRegexp('rpn 2 3 foobar', 'SyntaxError')
|
||||||
|
|
||||||
def testConvert(self):
|
def testConvert(self):
|
||||||
self.assertResponse('convert 1 m to cm', '100 cm')
|
self.assertResponse('convert 1 m to cm', '100')
|
||||||
self.assertResponse('convert m to cm', '100 cm')
|
self.assertResponse('convert m to cm', '100')
|
||||||
self.assertResponse('convert 3 metres to km', '0.003 km')
|
self.assertResponse('convert 3 metres to km', '0.003')
|
||||||
self.assertResponse('convert 32 F to C', '0 C')
|
self.assertResponse('convert 32 F to C', '0')
|
||||||
self.assertResponse('convert 32 C to F', '89.6 F')
|
self.assertResponse('convert 32 C to F', '89.6')
|
||||||
self.assertResponse('convert [calc 2*pi] rad to degree', '360 degree')
|
self.assertResponse('convert [calc 2*pi] rad to degree', '360')
|
||||||
self.assertResponse('convert amu to atomic mass unit',
|
self.assertResponse('convert amu to atomic mass unit',
|
||||||
'1 atomic mass unit')
|
'1')
|
||||||
self.assertResponse('convert [calc 2*pi] rad to circle', '1 circle')
|
self.assertResponse('convert [calc 2*pi] rad to circle', '1')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -159,11 +159,11 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testConvertSingularPlural(self):
|
def testConvertSingularPlural(self):
|
||||||
self.assertResponse('convert [calc 2*pi] rads to degrees',
|
self.assertResponse('convert [calc 2*pi] rads to degrees',
|
||||||
'360 degrees')
|
'360')
|
||||||
self.assertResponse('convert 1 carat to grams',
|
self.assertResponse('convert 1 carat to grams',
|
||||||
'0.2 grams')
|
'0.2')
|
||||||
self.assertResponse('convert 10 lbs to oz', '160 oz')
|
self.assertResponse('convert 10 lbs to oz', '160')
|
||||||
self.assertResponse('convert mA to amps', '0.001 amps')
|
self.assertResponse('convert mA to amps', '0.001')
|
||||||
|
|
||||||
def testConvertCaseSensitivity(self):
|
def testConvertCaseSensitivity(self):
|
||||||
self.assertError('convert MA to amps')
|
self.assertError('convert MA to amps')
|
||||||
|
Loading…
Reference in New Issue
Block a user