[Numpy-discussion] code review/build & test for datetime business day API

Derek Homeier derek@astro.physik.uni-goettingen...
Wed Jun 15 17:16:25 CDT 2011


On 15.06.2011, at 1:34AM, Mark Wiebe wrote:

> These functions are now fully implemented and documented. As always, code reviews are welcome here:
> 
> https://github.com/numpy/numpy/pull/87
> 
> and for those that don't want to dig into review C code, the commit for the documentation is here:
> 
> https://github.com/m-paradox/numpy/commit/6b5a42a777b16812e774193b06da1b68b92bc689
> 
> This is probably also another good place to do a merge to master, so if people could test it on Mac/Windows/other platforms that would be much appreciated.
> 
Probaby not specifically related to the business day, but to this month's general datetime fix-up, 
under Python3 there are a number of test failures of the kinds quoted below. 
You can review a fix (plus a number of additional test extensions and proposed fix for other 
failures on master) at
https://github.com/dhomeier/numpy/compare/master...dt_tests_2to3

Plus on Mac OS X 10.5 PPC there is a failure due to the fact that the new datetime64 appears 
to _always_ return 0 for the year part on this architecture:

>>> date='1970-03-23 20:00:00Z'
>>> np.datetime64(date)
np.datetime64('0000-03-23T21:00:00+0100','s')
>>> np.datetime64(date, 'Y')
np.datetime64('0000','Y')
>>> np.datetime64('2011-06-16 02:03:04Z', 'D')
np.datetime64('0000-06-16','D')

I've tried to track this down in datetime.c, but unsuccessfully so (i.e. I could not connect it 
to any of the dts->year assignments therein). 

For the record, all tests pass with Python2.5-2.7 on OS X 10.5/10.6 i386 and x86_64.

Cheers,
						Derek


FAIL: test_datetime_as_string (test_datetime.TestDateTime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/derek/lib/python3.2/site-packages/numpy/core/tests/test_datetime.py", line 970, in test_datetime_as_string
    '1959')
  File "/Users/derek/lib/python3.2/site-packages/numpy/testing/utils.py", line 313, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: b'0000'
 DESIRED: '1959'

======================================================================
FAIL: test_days_creation (test_datetime.TestDateTime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/derek/lib/python3.2/site-packages/numpy/core/tests/test_datetime.py", line 287, in test_days_creation
    (1900-1970)*365 - (1970-1900)/4)
  File "/Users/derek/lib/python3.2/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/Users/derek/lib/python3.2/site-packages/numpy/testing/utils.py", line 706, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/Users/derek/lib/python3.2/site-packages/numpy/testing/utils.py", line 635, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

(mismatch 100.0%)
 x: array(-25567, dtype='int64')
 y: array(-25567.5)



More information about the NumPy-Discussion mailing list