MCPcopy Index your code
hub / github.com/clips/pattern / test_format

Method test_format

test/test_db.py:152–166  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

150 print "pattern.db.date()"
151
152 def test_format(self):
153 # Assert custom input formats.
154 v = db.date("2010-09", "%Y-%m")
155 self.assertEqual(str(v), "2010-09-01 00:00:00")
156 self.assertEqual(v.year, 2010)
157 # Assert custom output formats.
158 v = db.date("2010-09", "%Y-%m", format="%Y-%m")
159 self.assertEqual(v.format, "%Y-%m")
160 self.assertEqual(str(v), "2010-09")
161 self.assertEqual(v.year, 2010)
162 # Assert strftime() for date < 1900.
163 v = db.date(1707, 4, 15)
164 self.assertEqual(str(v), "1707-04-15 00:00:00")
165 self.assertRaises(ValueError, lambda: v.timestamp)
166 print "pattern.db.Date.__str__()"
167
168 def test_timestamp(self):
169 # Assert Date.timestamp.

Callers

nothing calls this directly

Calls 2

strFunction · 0.85
dateMethod · 0.80

Tested by

no test coverage detected