Re: Testing properties that are date-related

2011-10-07 Thread Tim Chase
On 10/07/11 09:45, Ethan Furman wrote: Tim Chase wrote: On 10/07/11 07:38, Peter Otten wrote: def setUp(self): foo.window_date = functools.partial(foo.window_date, around=date(2011, 1, 1)) it worked like a charm. Another option is injection: import foo def window_date(...)

Re: Testing properties that are date-related

2011-10-07 Thread Ethan Furman
Tim Chase wrote: On 10/07/11 07:38, Peter Otten wrote: Are there best practices for testing dates that are properties which take the current date into consideration The problem is that the behavior of the window_date function depends on the current date (the function makes a guess about adding

Re: Testing properties that are date-related

2011-10-07 Thread Tim Chase
On 10/07/11 07:38, Peter Otten wrote: Are there best practices for testing dates that are properties which take the current date into consideration The problem is that the behavior of the window_date function depends on the current date (the function makes a guess about adding the century if the

Re: Testing properties that are date-related

2011-10-07 Thread Peter Otten
Tim Chase wrote: > Are there best practices for testing dates that are properties > which take the current date into consideration? I have something > like > >class Foo: > def _get_year_range(self): >return (self._min_year, self._max_year) > def _set_year_range(self, year):

Testing properties that are date-related

2011-10-07 Thread Tim Chase
Are there best practices for testing dates that are properties which take the current date into consideration? I have something like class Foo: def _get_year_range(self): return (self._min_year, self._max_year) def _set_year_range(self, year): if isinstance(year, tuple):