Opened 10 years ago

Closed 10 years ago

Last modified 5 years ago

#9859 closed defect (fixed)

Doctest failures due to hard-coded line numbers in (doctests of) sage/rings/*.pyx

Reported by: leif Owned by: mvngu
Priority: trivial Milestone: sage-4.6
Component: doctest coverage Keywords: DeprecationWarning failure integer.pyx rational.pyx beginner
Cc: Merged in: sage-4.6.alpha1
Authors: Leif Leonhardy Reviewers: Minh Van Nguyen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by chapoton)

$ ./sage -t  -long devel/sage/sage/rings/integer.pyx
sage -t -long "devel/sage/sage/rings/integer.pyx"           
**********************************************************************
File "devel/sage/sage/rings/integer.pyx", line 4618:
    sage: 5.sqrt_approx(prec=200)
Expected:
    doctest:1172: DeprecationWarning: This function is deprecated.  Use sqrt with a given number of bits of precision instead.
    2.2360679774997896964091736687312762354406183596115257242709
Got:
    doctest:1176: DeprecationWarning: This function is deprecated.  Use sqrt with a given number of bits of precision instead.
    2.2360679774997896964091736687312762354406183596115257242709
**********************************************************************
1 items had failures:
   1 of   5 in __main__.example_118
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/leif/.sage//tmp/.doctest_integer.py
 [16.4 s]
 
----------------------------------------------------------------------
The following tests failed:


sage -t -long "devel/sage/sage/rings/integer.pyx"
Total time for all tests: 16.4 seconds
$ ./sage -t  -long devel/sage/sage/rings/rational.pyx 
sage -t -long "devel/sage/sage/rings/rational.pyx"          
**********************************************************************
File "devel/sage/sage/rings/rational.pyx", line 1339:
    sage: (5/3).sqrt_approx()
Expected:
    doctest:1172: DeprecationWarning: This function is deprecated.  Use sqrt with a given number of bits of precision instead.
    1.29099444873581
Got:
    doctest:1176: DeprecationWarning: This function is deprecated.  Use sqrt with a given number of bits of precision instead.
    1.29099444873581
**********************************************************************
1 items had failures:
   1 of   6 in __main__.example_31
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/leif/.sage//tmp/.doctest_rational.py
 [4.5 s]
 
----------------------------------------------------------------------
The following tests failed:


sage -t -long "devel/sage/sage/rings/rational.pyx"
Total time for all tests: 4.6 seconds

These failures occurred just because some line numbers in $SAGE_LOCAL/bin/ncadoctest.py changed (when I added some flush statements).

Attachments (1)

trac_9859-fix_hard-coded_doctest_line_numbers.patch (1.7 KB) - added by leif 10 years ago.
Based on Sage 4.5.3.rc0. Apply to Sage library.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by leif

Minh, please excuse and change the component in case it's the wrong one. (I'm not sure if "doctest" refers to the framework or doctest failures in general.)

Changed 10 years ago by leif

Based on Sage 4.5.3.rc0. Apply to Sage library.

comment:2 Changed 10 years ago by leif

  • Authors set to Leif Leonhardy
  • Status changed from new to needs_review
  • Work issues Replace line numbers in doctests by ellipses. deleted

Ok, I'm a beginner. ;-)

(I've uploaded a patch.)

comment:3 follow-up: Changed 10 years ago by mvngu

  • Reviewers set to Minh Van Nguyen
  • Status changed from needs_review to positive_review

Those hard-coded line numbers that leif fixed shouldn't have been there in the first place. The patch applied OK against Sage 4.5.3.rc0, all doctests (including long) passed, and the standard documentation built fine. And I'm OK with the changes in the patch.

comment:4 in reply to: ↑ 3 Changed 10 years ago by leif

Replying to mvngu:

Those hard-coded line numbers that leif fixed shouldn't have been there in the first place.

Yes. According to Mercurial, Michael Abshoff introduced that in Jan 2009(!)... :-) (There's no ticket number in the commit message. I'm not sure when it really got merged, but obviously long time ago.)

I wonder why I never ran into this before, since I frequently doctest with modified versions of ncadoctest (but perhaps incidentally not the whole Sage library, or sage/rings).

Thanks for reviewing this.

comment:5 Changed 10 years ago by mpatel

  • Merged in set to sage-4.6.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:6 Changed 5 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.