Closed hugovk closed 10 years ago
Unicode tests added to PR #20.
So, on my Mac: These tests fail too, when run from a folder with freshly downloaded source. They pass when using the installed version of Wordnik. My real code works too, and uses the installed version of Wordnik.
On Windows: Tests fail from downloaded Wordnik. Real code fails using installed Wordnik.
I'll investigate further.
Comparing my site-packages\wordnik for each machine, both match except for line 100 of swagger.py (in sanitizeForSerialization(self, obj)
)
PC and latest source have:
elif type(obj) in [str, int, long, float, bool]:
Mac has:
elif type(obj) in [str, int, long, float, bool, unicode]:
I'm not entirely sure where that unicode
came from. All the other source files have April 15th timestamps but swagger.py has April 16th. It's possible it's a change I made but forgot about. (At this time I switched from the older Wordnik Python library/API to the new one, and perhaps this was in the old one?)
Anyway, the tests pass and Unicode words can be successfully added to Wordnik lists. I'll make a pull request with a changed swagger.py.
@hugovk Thanks for the great error report and PRs! I've merged yours and added some more tests and fixes for unicode in 5c589c0844b05e5d4154e65ba302aa62e0262f05 . Much appreciated.
I can add Unicode words to Worknik lists with a Mac but not Windows. I don't have the Mac with me now to compare configurations but both have Python 2.7.
This can easily be reproduced with
testAddWordsToWordList()
in WordListApiTest.py.With no changes the test passes. But if, for example, you change the string
"delicious"
on line 62 to Unicodeu"delicious"
it fails.https://github.com/wordnik/wordnik-python/blob/master/tests/WordListApiTest.py#L62
Output of
python tests\WordListApiTest.py
: