[issue10654] test_datetime fails on Python3.2 windows binary

Hirokazu Yamamoto report at bugs.python.org
Wed Dec 8 21:24:37 CET 2010


Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

"NotImplementedError" was printed. This happened
when subclass of date or subclass of datetime.
(plain classes and subclass of time didn't print this)

////////////////////////////////////
// Code

from _datetime import date, datetime

class SubclassDate(date):
    sub_var = 1

a = SubclassDate(2002, 3, 2)
for i in 1, 1.0:
    print(a+i)  # "NotImplemented"

class SubclassDateTime(datetime):
    sub_var = 1

a = SubclassDateTime(2002, 3, 2, 3, 5)
for i in 1, 1.0:
    print(a+i)  # "NotImplemented"
a-i # TypeError: unsupported operand type(s) for -: 'SubclassDateTime' and 'float'

////////////////////////////////////
// Result

E:\python-dev\py3k>c:\Python32\python.exe \x.py
NotImplemented
NotImplemented
NotImplemented
NotImplemented
Traceback (most recent call last):
  File "\x.py", line 17, in <module>
    a-i # TypeError
TypeError: unsupported operand type(s) for -: 'SubclassDateTime' and 'float'

////////////////////////////////////////

I hope this helps.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10654>
_______________________________________


More information about the Python-bugs-list mailing list