diff --git a/modules/calc.py b/modules/calc.py index c3e9b01..5acb171 100644 --- a/modules/calc.py +++ b/modules/calc.py @@ -41,7 +41,9 @@ def c(phenny, input): if answer: #answer = ''.join(chr(ord(c)) for c in answer) #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('', '^(') answer = answer.replace('', ')') answer = web.decode(answer) diff --git a/modules/test/test_calc.py b/modules/test/test_calc.py index 9f62918..7b61e5f 100644 --- a/modules/test/test_calc.py +++ b/modules/test/test_calc.py @@ -18,6 +18,12 @@ class TestCalc(unittest.TestCase): 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): input = Mock(group=lambda x: "'test'*3") py(self.phenny, input)