Opened 3 years ago

Closed 3 years ago

#21078 closed defect (fixed)

failing doctest with TamariIntervalPosets_size

Reported by: vdelecroix Owned by:
Priority: blocker Milestone: sage-7.3
Component: combinatorics Keywords:
Cc: VivianePons, chapoton, tscrim, gchatel, kdilks Merged in:
Authors: Vincent Delecroix Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 878755a (Commits) Commit: 878755a42decfd837b4ad1ad53613bd2045ef302
Dependencies: Stopgaps:

Description

There is a failing doctest in sage/combinat/interval_posets.py in sage-7.3.beta9

sage: from sage.combinat.interval_posets import TamariIntervalPosets_size
sage: for i in xrange(6): TestSuite(TamariIntervalPosets_size(i)).run()
------------------------------------------------------------
The following tests failed: _test_cardinality
Failure in _test_cardinality:
Traceback (most recent call last):
  File "/opt/sage/local/lib/python2.7/site-packages/sage/misc/sage_unittest.py", line 283, in run
    test_method(tester = tester)
  File "/opt/sage/local/lib/python2.7/site-packages/sage/categories/sets_cat.py", line 1410, in _test_cardinality
    "the output of the method cardinality must either be a Sage integer or infinity. Not {}.".format(type(cardinality)))
  File "/opt/sage/local/lib/python/unittest/case.py", line 424, in assertTrue
    raise self.failureException(msg)
AssertionError: the output of the method cardinality must either be a Sage integer or infinity. Not <type 'int'>.
------------------------------------------------------------
The following tests failed: _test_cardinality

Change History (13)

comment:1 Changed 3 years ago by vdelecroix

  • Summary changed from failing doctest in TamariIntervalPosets_size to failing doctest with TamariIntervalPosets_size

comment:2 Changed 3 years ago by vdelecroix

  • Cc ​andrew.mathas added

probably due to #20240

comment:3 Changed 3 years ago by tscrim

  • Cc gchatel kdilks added; ​andrew.mathas removed

comment:4 Changed 3 years ago by vbraun

I can't reproduce. #20921 seems related.

comment:5 Changed 3 years ago by vdelecroix

2/3 patchbots are able to reproduce it

https://patchbot.sagemath.org/ticket/0/

may be related to the fact that coxeter3 is present... I don't know.

comment:6 Changed 3 years ago by vdelecroix

Note that the failure is order dependent because of UniqueRepresentation that thinks that Sage Integer 1 is the same as Python int 1.

sage: from sage.combinat.interval_posets import TamariIntervalPosets_size
sage: T1 = TamariIntervalPosets_size(1)
sage: T2 = TamariIntervalPosets_size(1r)
sage: print (parent(T1._size), parent(T2._size))
(Integer Ring, Integer Ring)

vs

sage: from sage.combinat.interval_posets import TamariIntervalPosets_size
sage: T2 = TamariIntervalPosets_size(1r)
sage: T1 = TamariIntervalPosets_size(1)
sage: print (parent(T1._size), parent(T2._size))
(<type 'int'>, <type 'int'>)

comment:7 Changed 3 years ago by tscrim

It seems like the best solution is probably to make sure the output of cardinality() is in ZZ.

comment:8 Changed 3 years ago by vdelecroix

It will automatically the case if the attribute _size is itself an Integer.

Last edited 3 years ago by vdelecroix (previous) (diff)

comment:9 Changed 3 years ago by vdelecroix

  • Authors set to Vincent Delecroix
  • Branch set to u/vdelecroix/21078
  • Commit set to 878755a42decfd837b4ad1ad53613bd2045ef302
  • Status changed from new to needs_review

New commits:

878755aTrac 21078: fix poset doctest

comment:10 Changed 3 years ago by tscrim

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

I think this is a better test too. Thanks. (Also sorry for not doing it myself; I've been traveling the past few days.)

comment:11 Changed 3 years ago by vdelecroix

The previous doctest was actually a mistake. The __clascall_private__ is not inherited.

comment:12 Changed 3 years ago by vdelecroix

Thanks for the review!

comment:13 Changed 3 years ago by vbraun

  • Branch changed from u/vdelecroix/21078 to 878755a42decfd837b4ad1ad53613bd2045ef302
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.