Don't respond with the units so as to ease nesting convert and calc

This commit is contained in:
James Vega 2004-03-01 23:18:21 +00:00
parent 212da17352
commit e31aa252dd
2 changed files with 13 additions and 13 deletions

View File

@ -328,7 +328,7 @@ class Math(callbacks.Privmsg):
newNum = convertcore.convert(num, unit1, unit2)
newNum = self._floatToString(newNum)
irc.reply('%s %s' % (newNum , unit2))
irc.reply('%s' % newNum)
except convertcore.UnitDataError, ude:
irc.error(str(ude))

View File

@ -140,15 +140,15 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
self.assertNotRegexp('rpn 2 3 foobar', 'SyntaxError')
def testConvert(self):
self.assertResponse('convert 1 m to cm', '100 cm')
self.assertResponse('convert m to cm', '100 cm')
self.assertResponse('convert 3 metres to km', '0.003 km')
self.assertResponse('convert 32 F to C', '0 C')
self.assertResponse('convert 32 C to F', '89.6 F')
self.assertResponse('convert [calc 2*pi] rad to degree', '360 degree')
self.assertResponse('convert 1 m to cm', '100')
self.assertResponse('convert m to cm', '100')
self.assertResponse('convert 3 metres to km', '0.003')
self.assertResponse('convert 32 F to C', '0')
self.assertResponse('convert 32 C to F', '89.6')
self.assertResponse('convert [calc 2*pi] rad to degree', '360')
self.assertResponse('convert amu to atomic mass unit',
'1 atomic mass unit')
self.assertResponse('convert [calc 2*pi] rad to circle', '1 circle')
'1')
self.assertResponse('convert [calc 2*pi] rad to circle', '1')
@ -159,11 +159,11 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
def testConvertSingularPlural(self):
self.assertResponse('convert [calc 2*pi] rads to degrees',
'360 degrees')
'360')
self.assertResponse('convert 1 carat to grams',
'0.2 grams')
self.assertResponse('convert 10 lbs to oz', '160 oz')
self.assertResponse('convert mA to amps', '0.001 amps')
'0.2')
self.assertResponse('convert 10 lbs to oz', '160')
self.assertResponse('convert mA to amps', '0.001')
def testConvertCaseSensitivity(self):
self.assertError('convert MA to amps')