Commit f52aabd7 authored by Jason Madden's avatar Jason Madden

Also make the str() value match betwenn C and Python TimeStamp objects; test this.

parent 1bc7c0e4
......@@ -192,6 +192,11 @@ class PyAndCComparisonTests(unittest.TestCase):
c, py = self._make_C_and_Py(*args)
self.assertEqual(repr(c), repr(py))
def test_strs_equal(self):
for args in self._make_many_instants():
c, py = self._make_C_and_Py(*args)
self.assertEqual(str(c), str(py))
def test_raw_equal(self):
c, py = self._make_C_and_Py(*self.now_ts_args)
self.assertEqual(c.raw(), py.raw())
......
......@@ -91,6 +91,12 @@ class pyTimeStamp(object):
def __repr__(self):
return repr(self._raw)
def __str__(self):
return "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%09.6f" % (
self.year(), self.month(), self.day(),
self.hour(), self.minute(),
self.second())
def year(self):
return self._elements[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment