Hi,

2011/6/20 [email protected] <[email protected]>

> Certain tests pass if unicode characters are escaped (like in u"\XXXX") but
> do not pass if the character is written in unicode (like u"ะค"). For examples
> see the tests that fail in the branch quantum_printing.
>
> Those test pass if they are run in python, fail in ipython (there is a bug
> in ipython
> http://stackoverflow.com/questions/5860713/ipython-unicode-in-gnome-terminal-linux)
> and fail in sympy-bot (I don't know why). They pass if the characters are
> escaped.
>

How did you run those tests in IPython? I tried your branch both in Python
(2.6.6) and IPython and all run fine. I used this:

In [1]: from sympy.utilities.runtests import test

In [2]: test("sympy/physics")
(...)

to run tests under IPython.


>
> My questions is not how to write the test that I gave as an example - they
> will be rewritten with escaped characters. The question is should I use
> unicode characters (that should be supported by the language) even when some
> tools seem to have problems with them? To me it seems a bad idea always to
> escape characters - the tests become unreadable.
>

Do you experience any problems with tests in sympy.printing.pretty? If not
then you should follow *exactly* the approach in pretty and you should be on
the safe side. I see that you implemented printers for physics module
outside sympy.printing. What it the rationale for this? I would create mixin
classes for repr, str, pretty and latex with appropriate printing methods
and add those classes as basses to appropriate printers. This way, you will
have to make sure that Unicode is setup properly only in one or two files,
not n >> 2.

I would also use U() function from pretty_symbology.py, to make sure that
Unicode character you use is actually globally available. U() will give you
None if given character (which you will specify by Unicode name) belongs to
the standard or not. It often happens that on a certain platform you can get
more Unicode symbols, but they aren't available elsewhere.


>
> Regards
> Stefan
>
> P.S. # -*- encoding: utf-8 -*- was present when the tests failed
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

Mateusz

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to