#18456: Re-Fix standard_packages(), optional_packages(), and
experimental_packages()
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  ncohen                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.8
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  distribution           |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  985474957e3f7327e635c7aa13dbf70f510c727f
  Nathann Cohen          |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/ncohen/18456         |
   Dependencies:         |
  #18431                 |
-------------------------+-------------------------------------------------

Comment (by jhpalmieri):

 I get an error with the new doctest:
 {{{
 sage -t --long src/sage/misc/package.py
 **********************************************************************
 File "src/sage/misc/package.py", line 244, in
 sage.misc.package._package_lists_from_sage_output
 Failed example:
     type(x[1]) == str and '4.55' <= x[1]
 Exception raised:
     Traceback (most recent call last):
       File
 "/Users/jpalmier/Desktop/Sage_stuff/git/sage/local/lib/python2.7/site-
 packages/sage/doctest/forker.py", line 496, in _run
         self.compile_and_execute(example, compiler, test.globs)
       File
 "/Users/jpalmier/Desktop/Sage_stuff/git/sage/local/lib/python2.7/site-
 packages/sage/doctest/forker.py", line 858, in compile_and_execute
         exec(compiled, globs)
       File "<doctest
 sage.misc.package._package_lists_from_sage_output[8]>", line 1, in
 <module>
         type(x[Integer(1)]) == str and '4.55' <= x[Integer(1)]
     TypeError: 'sage.symbolic.expression.Expression' object does not
 support indexing
 **********************************************************************
 }}}
 The problem is that `x` does not get set by the expression `any(x[0]
 ...)`. You could maybe use this instead:
 {{{
 #!diff
 diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
 index 12b556d..91ab594 100644
 --- a/src/sage/misc/package.py
 +++ b/src/sage/misc/package.py
 @@ -239,9 +239,7 @@ def
 _package_lists_from_sage_output(package_type,version=False,local=False):
          sage: installed, not_installed =
 _package_lists_from_sage_output('standard',local=True,version=True)
          sage: bool(not_installed)
          False
 -        sage: any(x[0] == 'glpk' for x in installed)
 -        True
 -        sage: type(x[1]) == str and '4.55' <= x[1]
 +        sage: any(x[0] == 'glpk' and type(x[1]) == str and '4.55' <= x[1]
 for x in installed)
          True
      """
      if package_type not in ['standard','optional','experimental']:
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18456#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to