Opened 5 months ago

Closed 5 months ago

#26316 closed defect (fixed)

py3: doctests for commutative_dga.py

Reported by: jhpalmieri Owned by:
Priority: minor Milestone: sage-8.4
Component: python3 Keywords:
Cc: chapoton, tscrim Merged in:
Authors: John Palmieri Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 3deb7a0 (Commits) Commit: 3deb7a0cdabd9568fef827620d85dd8ac8367565
Dependencies: Stopgaps:

Description

Fix the py3 doctests for src/algebras/commutative_dga.py.

Change History (5)

comment:1 Changed 5 months ago by jhpalmieri

  • Branch set to u/jhpalmieri/dga-py3

comment:2 Changed 5 months ago by jhpalmieri

  • Commit set to 3deb7a0cdabd9568fef827620d85dd8ac8367565

There are three changes: change d.iteritems() to d.items() in one place – that one is clear, and it's because of a recent change that I made. Second, I see two failures of this form:

File "src/sage/algebras/commutative_dga.py", line 202, in sage.algebras.commutative_dga.?.__init__
Failed example:
    TestSuite(d).run(skip="_test_category")
Expected nothing
Got:
    Failure in _test_nonzero_equal:
    Traceback (most recent call last):
      File "sage/categories/morphism.pyx", line 399, in sage.categories.morphism.Morphism.__nonzero__ (build/cythonized/sage/categories/morphism.c:6060)
        return self._is_nonzero()
      File "sage/structure/element.pyx", line 495, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4558)
        return self.getattr_from_category(name)
      File "sage/structure/element.pyx", line 508, in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4667)
        return getattr_from_other_class(self, cls, name)
      File "sage/cpython/getattr.pyx", line 394, in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2536)
        raise AttributeError(dummy_error_message)
    AttributeError: 'Differential' object has no attribute '_is_nonzero'
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.4.beta5/local/lib/python3.6/site-packages/sage/misc/sage_unittest.py", line 294, in run
        test_method(tester = tester)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.4.beta5/local/lib/python3.6/site-packages/sage/categories/additive_magmas.py", line 789, in _test_nonzero_equal
        tester.assertEqual(bool(self), self != self.parent().zero())
      File "sage/categories/morphism.pyx", line 401, in sage.categories.morphism.Morphism.__nonzero__ (build/cythonized/sage/categories/morphism.c:6131)
        return super(Morphism, self).__nonzero__()
    AttributeError: 'super' object has no attribute '__nonzero__'
    ------------------------------------------------------------
    The following tests failed: _test_nonzero_equal

So I added a _is_nonzero method for the Differential class. Third, a traceback has a different form in Python 2 compared to Python 3, so I added ... in a suitable place.


New commits:

3deb7a0trac 26316: fix py3 doctests for commutative_dga.py.

comment:3 Changed 5 months ago by jhpalmieri

  • Status changed from new to needs_review

comment:4 Changed 5 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:5 Changed 5 months ago by vbraun

  • Branch changed from u/jhpalmieri/dga-py3 to 3deb7a0cdabd9568fef827620d85dd8ac8367565
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.