The code is from sympy import I, symbols, Matrix, pretty, latex from sympy.physics.quantum.tensorproduct import TensorProduct as TP
import sympy.physics.quantum.spin as s pr = TP(s.Jz,s.Jx)*TP(s.JzKet(1,0),s.JyKet(1,1)) # TODO assert pretty(pr) == On 20 April 2011 18:14, [email protected] < [email protected]> wrote: > The problem is that I am not able to create the u""" """ string in an > automatic manner (and if I just copy-paste from the isympy terminal I get > SyntaxError: Non-ASCII character) > > for example pretty(pr) gives > > J ⨂ J ⋅❘z:1,0⟩⨂ ❘y:1,1⟩ > z x > > Now to write a test I must search for ⨂ in a unicode table or in the > source. Is there an automatic way to get the \uXXX representation for those > characters. > > I tried some stuff from > > http://stackoverflow.com/questions/1207457/convert-unicode-to-string-in-python-containing-extra-symbols > and > http://docs.python.org/howto/unicode.html > but nothing very useful. > > The branch is https://github.com/sympy/sympy/pull/186 > > Regards > Stefan > > > On 20 April 2011 17:25, Alexey U. Gudchenko <[email protected]> wrote: > >> 20.04.2011 15:08, [email protected] пишет: >> > Hi, >> > >> > I have a branch that is ready for review (and hopefully inclusion) but I >> > have left a few assert tests commented with a TODO tag. Those tests deal >> > with pretty printing and it would be nice to finish them, but >> reconstructing >> > unicode strings with escape characters is not very amusing. >> > >> > Is there any convenience function that will give me not only the unicode >> > string of a pretty print representation, but it will also translate the >> > non-ascii characters to \uXXXX substring? >> > >> > Regards >> > Stefan >> > >> >> Hi, >> >> What is the pull request number or the branch and repository or the >> example? >> >> I suppose that you can quite the contrary use u""" """ syntax (or >> unicode() ) applying to expected etalon to compare it with resulted >> unicode string. >> >> >> -- >> Alexey U. >> >> -- >> 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. >> >> > -- 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.
