Yes, in the docstring. The docstring examples are run in a completely isolated environment from the file itself.
Aaron Meurer On Fri, Jul 19, 2013 at 1:40 PM, Mary Clark <[email protected]> wrote: > So, do I need the >>>>from sympy.liealgebras.cartan_type import CartanType > inside the docstring? If that's the case, I didn't realise it needed to be > in the docstring, I just had it at the top of the file. > > > > On Friday, 19 July 2013 19:33:14 UTC+1, Aaron Meurer wrote: >> >> You have to import everything that you use. Like I said, it's run as >> if it were in a fresh Python session. So to use CartanType, you first >> have to have a line like >> >> >>> from sympy.liealgebras.cartan_type import CartanType >> >> (or wherever it is located) >> >> If you just start a fresh Python session, and type everything there >> that you would need to do the example, and then just copy-paste that >> into your doctest, that should work. >> >> Aaron Meurer >> >> On Fri, Jul 19, 2013 at 12:42 PM, Mary Clark <[email protected]> wrote: >> > Does anyone else have any ideas why the doctests are still failing? I >> > tried changing things to an absolute import and the tests still failed. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/sympy. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
