Permalink
Browse files

* fixed an issue in DateArray.__repr__ (bug #98)

  • Loading branch information...
1 parent f0c3e46 commit 37291b4c740cfa534951aa960cb052df6bffeb39 pierregm committed Jan 3, 2010
@@ -885,7 +885,7 @@ def _listparser(dlist, freq=None):
# Case #2: dates as numbers .................
elif dlist.dtype.kind in 'if':
#...hopefully, they are values
- pass
+ dlist = dlist.astype(int)
# Case #3: dates as objects .................
elif dlist.dtype.kind == 'O':
template = dlist[0]
@@ -1190,6 +1190,13 @@ def test_pickling():
assert_equal(base, target)
+def test_repr():
+ "Test some oddity about repr (bug #98)"
+ data = [731694.]
+ test_1 = date_array(dlist=[ts.Date('d', _) for _ in data])
+ test_2 = date_array(dlist=data, freq='d')
+ assert_equal(repr(test_1), repr(test_2))
+
###############################################################################
#------------------------------------------------------------------------------
if __name__ == "__main__":
@@ -1191,7 +1191,15 @@ def test_pickling_memo(self):
assert_equal(test._dates, control._dates)
assert_equal(test, control)
assert_equal(test._optinfo, control._optinfo)
-
+ #
+# def test_pickling_oddity(self):
+# "Test some pickling oddity (bug #97)"
+# import cPickle
+# control = ts.time_series([{'a':1}], start_date=ts.Date('A', 2001))
+# if tuple(map(int, np.version.version.split('.')[:2])) > (1, 4):
+# test = cPickle.loads(cPickle.dumps(control))
+# assert_equal(test, control)
+# assert_equal(test.dates, control.dates)
def test_empty_timeseries(self):
"Tests that empty TimeSeries are handled properly"

0 comments on commit 37291b4

Please sign in to comment.