Skip to content

support simplified Chinese to calc and add test #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

support simplified Chinese to calc and add test #22

wants to merge 2 commits into from

Conversation

12ycli
Copy link

@12ycli 12ycli commented May 2, 2018

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')

@gunthercox
Copy link
Owner

@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.

add '# -*- coding: UTF-8 -*-'
@gunthercox
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants