On Feb 28, 5:54 pm, Lie Ryan lie.1...@gmail.com wrote:
Yuan HOng wrote:
HI,
In my project I have several date related methods which I want tested for
correctness. The functions use date.today() in several places. Since this
could change every time I run the test, I hope to find someway
Hello,
Thanks for all the great ideas. Based on your input, I was able to solve my
problem by way of a FakeDate in a fakedate module.
In the testing module, before importing the tested module, I would load my
fakedate module into sys.modules under the key 'datetime'. So when the
tested module is
HI,
In my project I have several date related methods which I want tested for
correctness. The functions use date.today() in several places. Since this
could change every time I run the test, I hope to find someway to fake a
date.today.
For illustration lets say I have a function:
from
Yuan HOng wrote:
HI,
In my project I have several date related methods which I want tested for
correctness. The functions use date.today() in several places. Since this
could change every time I run the test, I hope to find someway to fake a
date.today.
For illustration lets say I have a
Lie Ryan wrote:
But this fails with:
TypeError: can't set attributes of built-in/extension type
'datetime.date'
This is because today is an attribute. In python, we can override
attribute access to become a function call. I don't have python right
now, but try this:
del date.today
Christian Heimes li...@cheimes.de wrote:
Lie Ryan wrote:
But this fails with:
TypeError: can't set attributes of built-in/extension type
'datetime.date'
This is because today is an attribute. In python, we can override
attribute access to become a function call. I don't have python
En Sat, 28 Feb 2009 15:35:47 -0200, Yuan HOng hongyuan1...@gmail.com
escribió:
In my project I have several date related methods which I want tested for
correctness. The functions use date.today() in several places. Since this
could change every time I run the test, I hope to find someway to
Lie Ryan wrote:
Yuan HOng wrote:
In my project I have several date related methods which I want tested for
correctness. The functions use date.today() in several places. Since this
could change every time I run the test, I hope to find someway to fake a
date.today.
For illustration lets say I