1.6b1 joys & sorrows (was Re: Python 1.6b1 is released!)

Peter Schneider-Kamp nowonder at nowonder.de
Sun Aug 6 18:58:45 EDT 2000


Alex Martelli wrote:
> 
> Further, there seems to be no fully automatic way to regression
> test under Windows, either.  I did it manually and noticed a
> glitch in test_math.py -- it unconditionally tests math.rint,
> but as the docs make clear that method is only defined if it's
> there in the underlying C libraries, and it's not there on
> Windows, thus the math test fails.  No big issue, and I've

Right. A simple "try: ... except AttributeError: ..." construction
was added to test_math.py to fix this.

> already submitted the bug to sourceforge (finding it pleasantly
> simple to use), but it does suggest that regression tests are
> not systematically run under Windows.  I still haven't looked

Suggestions may be wrong. This one is.

The bug was fixed almost immediately (by Tim or some other
helpful deity) after I added those tests to test_math.py.

The problem is that the branch for the 1.6 CNRI release
was branched from the main branch (which is going to be the
2.0 BeOpen release) exactly between those two changes
to test_math.py. So 1.6b1 features the additional tests
but not the additional try-except wrapper to catch the
AttributeError on platforms not supporting rint().

The following patch should fix this:

Index: test_math.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v
retrieving revision 1.3
diff -c -r1.3 test_math.py
*** test_math.py        2000/05/11 18:19:41     1.3
--- test_math.py        2000/08/06 20:40:02
***************
*** 130,139 ****
  testit('pow(2,-1)', math.pow(2,-1), 0.5)

  print 'rint'
! testit('rint(0.7)', math.rint(0.7), 1)   ! testit('rint(-0.3)',
math.rint(-0.3), 0)
! testit('rint(2.5)', math.rint(2.5), 2)
! testit('rint(3.5)', math.rint(3.5), 4)

  print 'sin'
  testit('sin(0)', math.sin(0), 0)
--- 130,145 ----
  testit('pow(2,-1)', math.pow(2,-1), 0.5)

  print 'rint'
! try:
!       math.rint
! except AttributeError:
!       # this platform does not have rint, that is fine, skip the test
!       pass
! else:
!       testit('rint(0.7)', math.rint(0.7), 1)
!       testit('rint(-0.3)', math.rint(-0.3), 0)
!       testit('rint(2.5)', math.rint(2.5), 2)
!       testit('rint(3.5)', math.rint(3.5), 4)

  print 'sin'
  testit('sin(0)', math.sin(0), 0)

hope-that-helps-ly y'rs
Peter

P.S.: I wonder if there are more cases like that?!
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list