From: Brad C. <bk...@mu...> - 2005-10-10 23:31:01
|
I've changed gvib over to use datetime types as the "natural" data types for date and time, but still, test_datetime fails. The test looks a bit odd to me: def test_dateTime(): setupClass(DateTime1) _now = now() dt1 = DateTime1(col1=_now, col2=_now) assert isinstance(dt1.col1, date) assert isinstance(dt1.col2, datetime) today_str = _now.strftime("%Y-%m-%d") now_str = _now.strftime("%Y-%m-%d %T") assert str(dt1.col1) == today_str assert str(dt1.col2) == now_str since dt1.col2 is an instance of datetime, then str(dt1.col2) cannot possibly equal _now.strftime("%Y-%m-%d %T") Is this a valid test? Also, my python2.3 docs don't list %T as a valid directive for strftime. def test_dateTime(): setupClass(DateTime1) _now = now() dt1 = DateTime1(col1=_now, col2=_now) assert isinstance(dt1.col1, date) assert isinstance(dt1.col2, datetime) today_str = _now.strftime("%Y-%m-%d") now_str = _now.strftime("%Y-%m-%d %T") assert str(dt1.col1) == today_str E assert str(dt1.col2) == now_str > assert '2005-10-10 19:21:59' == '2005-10-10 ' + where '2005-10-10 19:21:59' = str(<DateTime1 6L col1='datetime.date( 200...)' col2='datetime.datetime...)'>.col2) -- Brad Clements, bk...@mu... (315)268-1000 http://www.murkworks.com AOL-IM or SKYPE: BKClements |