On Sat, Jul 20, 2013 at 9:23 AM, Ondřej Čertík <[email protected]> wrote:
> On Sat, Jul 20, 2013 at 7:19 AM, David Joyner <[email protected]> wrote:
>> On Sat, Jul 20, 2013 at 5:40 AM, Mary Clark <[email protected]> 
>> wrote:
>>>
>>>>
>>>> Looks like the "c" in list(c) is a Python int, so if you do list(c),
>>>> it returns an error. What is this line supposed to do?
>>>>
>>>> Does this happen when you run this doctest locally? That's the best
>>>> way to debug it.
>>>>
>>>> Ondrej
>>>
>>>
>>> Unfortunately, I don't seem to be able to run the doctest locally.   When I
>>> try, the following is displayed:
>>>
>>>
>>> sympy/liealgebras/type_a.py[?]   Failed to import
>>> [FAIL]
>>>
>>> I don't understand this error or how to fix it, so currently I am reliant on
>>> Travis to run the doctests.
>>>
>>> On the topic of the error: when I run type(c) to test the type, it returns
>>> str.  c is args, it's the input.  so c is "A4" or "A3" or whatever.  I guess
>>> I don't understand why the doctest gives this error, if the actually code
>>> runs fine, if that makes sense.  Surely if c was an int, the tests of type_A
>>> would fail as well, if that makes sense.
>>>>
>>>>
>>
>> One thing I do (and I think is good practice in general) is that if
>> you know you want
>> inputs n and c to be int and str, put
>> n = int(n)
>> c = str(c)
>> at the top of your code.
>>
>> Regarding
>> sympy/liealgebras/type_a.py[?]   Failed to import
>> are there other modules in liealgebras which are loaded, but
>> the module type_a is not? Also, if this is during a test, so from a
>> command in the tests
>> subdirectory, try inserting print statements. For example, in the
>> ntheory test module, between
>>
>> from sympy.ntheory.factor_ import smoothness, smoothness_p
>> from sympy.ntheory.generate import cycle_length
>>
>> insert a print
>>
>> from sympy.ntheory.factor_ import smoothness, smoothness_p
>> print "Hi Mary"
>> from sympy.ntheory.generate import cycle_length
>>
>> See where the failure lies. There are lots of debugging tools
>> around. I don't use any of them. I just insert print statements.
>> *Lots* of them:-)
>
> +1, I also just use print statements to be honest. It's simple and robust.
>
> Mary, please let us know if you can't figure it out. I tried it on my
> computer and there I get:
>
> https://gist.github.com/certik/6045437

Ok, I see what the problem is. You are debugging the liealgebras_2
branch, where I get:

https://gist.github.com/certik/6045444


However, is there any reason why you are trying to debug this branch
first? We'll get to it later.
For now, please let's get this PR in first:

https://github.com/sympy/sympy/pull/2237

there are still test failures, so we can't merge it. This PR
corresponds to the liealgebras_1 branch.
Once this is in, I can help with the other branch, it's probably just
a matter of importing a module or so.

Don't rely on Travis only, as it takes an hour or so to get the
results back, so it is extremely ineffective. Here is my suggestion
how to get the liealgebras_1 branch fixed quickly:

git checkout liealgebras_1  # make sure this is your latest branch
./bin/doctest sympy/liealgebras/type_A.py

You will see an output like this: https://gist.github.com/certik/6045437

Then follow David's approach to debug the failures. Now,
unfortunately, for this particular failure, the print statements don't
really work well, because it is a doctest and it catches all the print
statements somehow. For example if I apply the following patch:

diff --git a/sympy/liealgebras/cartan_type.py b/sympy/liealgebras/cartan_type.py
index 696711a..cd8fc33 100644
--- a/sympy/liealgebras/cartan_type.py
+++ b/sympy/liealgebras/cartan_type.py
@@ -7,6 +7,7 @@ class CartanType_generator(Basic):
     """
     def __call__(self, *args):
         c = args[0]
+        print c
         c = list(c)

         letter, n = c[0], int(c[1])


it doesn't show in the output. Aaron, do you know if there is any way
around this?

Anyway, Mary, for now, make sure that regular tests work. Do this:

ondrej@eagle:~/repos/sympy(liealgebras_1)$ bin/test sympy/liealgebras/
============================= test process starts ==============================
executable:         /usr/bin/python  (2.7.3-final-0) [CPython]
architecture:       64-bit
cache:              yes
ground types:       python
random seed:        96150561
hash randomization: on (PYTHONHASHSEED=2095780528)

sympy/liealgebras/tests/test_type_A.py[1] E                               [FAIL]

________________________________________________________________________________
______________ sympy/liealgebras/tests/test_type_A.py:test_type_A ______________
  File "/home/ondrej/repos/sympy/sympy/liealgebras/tests/test_type_A.py",
line 5, in test_type_A
    c = CartanType("A3")
  File "sympy/liealgebras/cartan_type.py", line 17, in __call__
    return type_A.CartanType(n)
  File "sympy/liealgebras/cartan_type.py", line 10, in __call__
    c = list(c)
TypeError: 'int' object is not iterable

=========== tests finished: 0 passed, 1 exceptions, in 0.00 seconds ============
DO *NOT* COMMIT!


And you will see an error. Then insert the print statement:

diff --git a/sympy/liealgebras/cartan_type.py b/sympy/liealgebras/cartan_type.py
index 696711a..cd8fc33 100644
--- a/sympy/liealgebras/cartan_type.py
+++ b/sympy/liealgebras/cartan_type.py
@@ -7,6 +7,7 @@ class CartanType_generator(Basic):
     """
     def __call__(self, *args):
         c = args[0]
+        print c
         c = list(c)

         letter, n = c[0], int(c[1])


Re-exucute the tests:

ondrej@eagle:~/repos/sympy(liealgebras_1)$ bin/test sympy/liealgebras/
============================= test process starts ==============================
executable:         /usr/bin/python  (2.7.3-final-0) [CPython]
architecture:       64-bit
cache:              yes
ground types:       python
random seed:        88078153
hash randomization: on (PYTHONHASHSEED=3373687459)

sympy/liealgebras/tests/test_type_A.py[1] A3
3
E                               [FAIL]

________________________________________________________________________________
______________ sympy/liealgebras/tests/test_type_A.py:test_type_A ______________
  File "/home/ondrej/repos/sympy/sympy/liealgebras/tests/test_type_A.py",
line 5, in test_type_A
    c = CartanType("A3")
  File "sympy/liealgebras/cartan_type.py", line 18, in __call__
    return type_A.CartanType(n)
  File "sympy/liealgebras/cartan_type.py", line 11, in __call__
    c = list(c)
TypeError: 'int' object is not iterable

=========== tests finished: 0 passed, 1 exceptions, in 0.00 seconds ============
DO *NOT* COMMIT!


You can see, that it prints "A3", which works for list("A3"), but then
it prints "3", and that fails, because list(3) fails.
The reason c=3 is because you are calling return type_A.CartanType(n),
where n=3. Mary, would you know how to fix this?

If not, please ask, we'll provide more help. Let's just concentrate on
this now and get it out of the way.


Thanks,
Ondrej

>
> Ondrej

-- 
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.


Reply via email to