Opened 6 months ago

Last modified 5 months ago

#27829 needs_work enhancement

Mark some tests involving `long` using the `# py2` tag

Reported by: jhpalmieri Owned by:
Priority: major Milestone: sage-8.9
Component: python3 Keywords:
Cc: Merged in:
Authors: John Palmieri Reviewers:
Report Upstream: N/A Work issues:
Branch: u/jhpalmieri/long-py2 (Commits) Commit: feac66d673a6786d58c25698f9614832f9161648
Dependencies: Stopgaps:

Description

Since long is not available in Python 3, we should mark tests involving it as for Python 2 only. This is part of #27696.

Change History (9)

comment:1 Changed 6 months ago by jhpalmieri

  • Branch set to u/jhpalmieri/long-py2

comment:2 Changed 6 months ago by jhpalmieri

  • Commit set to 422e759ac14469033937e9c12a1d77e2b4e31344
  • Status changed from new to needs_review

New commits:

422e759trac 27829: add "# py2" to some tests involving "long(...)"

comment:3 Changed 6 months ago by jhpalmieri

There are a few cases I didn't know what to do with. In the following, I don't think long(...) adds much, so I think it's okay to make these changes. I have not yet done so. Opinions?

  • src/sage/rings/complex_double.pyx

    diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx
    index ec43d0e199..21c9818780 100644
    a b cdef class ComplexDoubleField_class(sage.rings.ring.Field): 
    398398
    399399            sage: CDF(1) + RR(1)
    400400            2.0
    401             sage: CDF.0 - CC(1) - long(1) - RR(1) - QQbar(1)
     401            sage: CDF.0 - CC(1) - ZZ(1) - RR(1) - QQbar(1)
    402402            -4.0 + 1.0*I
    403403            sage: CDF.has_coerce_map_from(ComplexField(20))
    404404            False
  • src/sage/modules/free_module_element.pyx

    diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
    index 03d4d57a28..e069377806 100644
    a b def vector(arg0, arg1=None, arg2=None, sparse=None): 
    382382        (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
    383383        sage: v[3].parent()
    384384        Integer Ring
    385         sage: v = vector([float(23.4), int(2), complex(2+7*I), long(1)]); v
     385        sage: v = vector([float(23.4), int(2), complex(2+7*I), 1]); v
    386386        (23.4, 2.0, 2.0 + 7.0*I, 1.0)
    387387        sage: v[1].parent()
    388388        Complex Double Field
  • src/sage/rings/real_mpfr.pyx

    diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
    index ae74119795..a579b5a575 100644
    a b cdef class RealField_class(sage.rings.ring.Field): 
    719719
    720720        TESTS::
    721721
    722             sage: 1.0 - ZZ(1) - int(1) - long(1) - QQ(1) - RealField(100)(1) - AA(1) - RLF(1)
     722            sage: 1.0 - ZZ(1) - int(1) - 1 - QQ(1) - RealField(100)(1) - AA(1) - RLF(1)
    723723            -6.00000000000000
    724724            sage: R = RR['x']   # Hold reference to avoid garbage collection, see Trac #24709
    725725            sage: R.get_action(ZZ)

comment:4 Changed 6 months ago by git

  • Commit changed from 422e759ac14469033937e9c12a1d77e2b4e31344 to feac66d673a6786d58c25698f9614832f9161648

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

feac66dtrac 27829: add "# py2" to some tests involving "long(...)"

comment:5 follow-up: Changed 6 months ago by jdemeyer

I don't think that # optional - fricas py2 works the way you think it does: you need # py2 not # optional - py2.

comment:6 Changed 6 months ago by jdemeyer

For large numbers (which don't fit in a Python 2 int anyway), you can replace long() by int(), for example

a = long(-901824309821093821093812093810928309183091832091)

becomes

a = int(-901824309821093821093812093810928309183091832091)

(unless the goal of the doctest is precisely testing __long__ which is not the case here).

comment:7 in reply to: ↑ 5 Changed 6 months ago by jhpalmieri

Replying to jdemeyer:

I don't think that # optional - fricas py2 works the way you think it does: you need # py2 not # optional - py2.

It works exactly the way I think it does, I just made a mistake.

comment:8 Changed 6 months ago by jhpalmieri

  • Status changed from needs_review to needs_work

Any changes in #27826 are likely to affect this ticket, so marking as "needs work" until #27826 has stabilized.

comment:9 Changed 5 months ago by embray

  • Milestone changed from sage-8.8 to sage-8.9

Tickets still needing working or clarification should be moved to the next release milestone at the soonest (please feel free to revert if you think the ticket is close to being resolved).

Note: See TracTickets for help on using tickets.