calc: fix .c scientific output
parent
c702d7bc59
commit
2dbc8797e5
|
@ -41,7 +41,9 @@ def c(phenny, input):
|
||||||
if answer:
|
if answer:
|
||||||
#answer = ''.join(chr(ord(c)) for c in answer)
|
#answer = ''.join(chr(ord(c)) for c in answer)
|
||||||
#answer = answer.decode('utf-8')
|
#answer = answer.decode('utf-8')
|
||||||
answer = answer.replace('\xc2\xa0', ',')
|
answer = answer.replace('\\x26#215;', '*')
|
||||||
|
answer = answer.replace('\\x3c', '<')
|
||||||
|
answer = answer.replace('\\x3e', '>')
|
||||||
answer = answer.replace('<sup>', '^(')
|
answer = answer.replace('<sup>', '^(')
|
||||||
answer = answer.replace('</sup>', ')')
|
answer = answer.replace('</sup>', ')')
|
||||||
answer = web.decode(answer)
|
answer = web.decode(answer)
|
||||||
|
|
|
@ -18,6 +18,12 @@ class TestCalc(unittest.TestCase):
|
||||||
|
|
||||||
self.phenny.say.assert_called_once_with('25')
|
self.phenny.say.assert_called_once_with('25')
|
||||||
|
|
||||||
|
def test_c_scientific(self):
|
||||||
|
input = Mock(group=lambda x: '2^64')
|
||||||
|
c(self.phenny, input)
|
||||||
|
|
||||||
|
self.phenny.say.assert_called_once_with('1.84467441 * 10^(19)')
|
||||||
|
|
||||||
def test_py(self):
|
def test_py(self):
|
||||||
input = Mock(group=lambda x: "'test'*3")
|
input = Mock(group=lambda x: "'test'*3")
|
||||||
py(self.phenny, input)
|
py(self.phenny, input)
|
||||||
|
|
Loading…
Reference in New Issue