[liblouis-liblouisxml] Re: Shall I merge python3 bindings with the python2 bindings?

  • From: Hammer Attila <hammera@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 15 May 2012 13:37:47 +0200

Hy Michael,

I now looked Python 2.7 the Python3 compatible commit, works for me right.
I don't no how can you easy to run other test cases under Windows, but with harness related tests running I think if you run following command in the test directory:
python2.7 runharness.py
I get following results with Python 2.7:
root@hammera-Satellite-L300:/usr/src/liblouis/liblouis2/liblouis/tests# python2.7 runHarness.py
Processing harness/en-GB-g2_harness.py
0 of 3 tests failed.
Processing harness/hu1_harness.py
0 of 776 tests failed.
Processing harness/letterDefTest_harness.py
--- Braille Difference Failure: ---
text:                     '⠍⠎'
CursorAt: 0               '^ '
expected brl:             '⠎⠍'
actual brl:               '⠍⠎'
brlCursorAt: 0            '^ '
--- end ---
1 of 1 tests failed.
Unfortunately the last test failed me, possible this is a bug, hopefuly you will be not reproduce. In Python3 the runharness.py file not work, but I will be sending a patch to provide compatibility both two versions.

If you want run the doctests related test, you need using I think following command:
python2.7 check_doctest.py
In Python3 this test doesn't run yet, because some test example txt files in the doctests directory containing u' and u" prefixes. If I replaced this prefixes with normal apostrophe and quote markups, the doctests runned me right under Python3, but if I using Python2.7, I get following traceback error message with possible need resolving if you would like merging the Python3 and original Python louis binding:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest nl-BE-g1.ctb_test.txt[81]>", line 1, in <module>
        t.braille('3 \xd7 3 = 9')
      File "check_doctests.py", line 13, in braille
        return louis.translateString(self.tables, txt)
File "/usr/local/lib/python2.7/dist-packages/louis/__init__.py", line 159, in translateString
        inbuf = createStr(inbuf)
File "/usr/local/lib/python2.7/dist-packages/louis/__init__.py", line 46, in <lambda>
        createStr = lambda x: unicode(x)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)

Attila
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: