def test_dfp_sameperiod(): from e4t.load.provider.BISS import ts_DateFromPeriod f = 'D' n = 0 for y in range(0,2000): for p in range(0,367): try: d = ts_DateFromPeriod(f,y,p) q = ts_DateFromPeriod(f,int("%s%s" %(y,p))) assert d==q n += 1 except ValueError, exc: continue except AssertionError, exc: print y,p,d,q raise
def test_dt_b260overyears(): from e4t.load.provider.BISS import ts_DateFromPeriod p = 262 f = 'B' n = 0 for y in range(0,10000): try: d = ts_DateFromPeriod(f,y,p) n += 1 except ValueError, exc: continue
def test_newyearseve(): from e4t.load.provider.BISS import ts_DateFromPeriod n = 0 for y in range(0,2000): for f,M in (('A',1),('Q',4),('M',12),('W',53),('B',262),('D',366)): for p in range(1,M+1): try: d = ts_DateFromPeriod(f,y,p) n += 1 except ValueError, exc: #print "%s n. %d not existent for year %d" % (f,p,y) break
def test_ts_DateFromPeriod(): from e4t.load.provider.BISS import ts_DateFromPeriod d = ts_DateFromPeriod('A',2001001) assert d.toordinal()==730850 d = ts_DateFromPeriod('Q',2004003) assert d.toordinal()==731854 d = ts_DateFromPeriod('M',2004003);print d.toordinal(),d.strftime("%Y-%m-%d") assert d.toordinal()==731671 d = ts_DateFromPeriod('W',2004003);print d.toordinal(),d.strftime("%Y-%m-%d") assert d.toordinal()==731605 d = ts_DateFromPeriod('B',2004003);print d.toordinal(),d.strftime("%Y-%m-%d") assert d.toordinal()==731585 d = ts_DateFromPeriod('D',2004003);print d.toordinal(),d.strftime("%Y-%m-%d") assert d.toordinal()==731583
def test_dt2000307(): from e4t.load.provider.BISS import ts_DateFromPeriod assert ts_DateFromPeriod('D',2000,307) == ts_DateFromPeriod('D',2000307) assert ts_DateFromPeriod('D',2000,308) == ts_DateFromPeriod('D',2000308)