mathparse icon indicating copy to clipboard operation
mathparse copied to clipboard

support simplified Chinese to calc and add test

Open 12ycli opened this issue 7 years ago • 2 comments

support simplified Chinese to calc and add test: The following line means calc 9600/800,and now it get the right answer 200 mathparse.parse('九千六百除以八百', language='SIMPLIFIED_CHINESE')

12ycli avatar May 02 '18 13:05 12ycli

@12ycli Thank you, this looks like a great improvement.

It looks like the automated tests are failing for Python 2.7. Could you add the following to the top of mathparse.py to declare unicode encoding?

# -*- coding: utf-8 -*-

After that I think this should be able to be merged in.

gunthercox avatar May 05 '18 00:05 gunthercox

Testing out the changes locally, I noticed that a few tests appear to be failing randomly.

This is the output that I received:

======================================================================
FAIL: test_addition_words_large (tests.test_simplified_chinese.SimplifiedChineseTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gcox/GitHub/mathparse/tests/test_simplified_chinese.py", line 16, in test_addition_words_large
    self.assertEqual(result, 4701)
AssertionError: 400701 != 4701

======================================================================
FAIL: test_division_words_large (tests.test_simplified_chinese.SimplifiedChineseTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gcox/GitHub/mathparse/tests/test_simplified_chinese.py", line 36, in test_division_words_large
    self.assertEqual(str(result), '12.04')
AssertionError: '1002.04' != '12.04'
- 1002.04
?  --
+ 12.04

I will try to look over the changes and see if I can find anything that appears to be a possible cause.

gunthercox avatar May 13 '18 12:05 gunthercox