Permalink
Browse files

Add more free text parsing tests.

  • Loading branch information...
1 parent d2157db commit e7d63b298da3bd2f0b1c4ee03d4698eed50cc2d0 @sbuss committed Dec 26, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/tests.py
View
@@ -223,6 +223,12 @@ def test_naive(self):
self.assertFalse(converted.tzinfo is None)
self.assertEqual(converted.tzinfo, pytz.timezone("US/Pacific"))
+ def test_sysdate_free(self):
+ s = "Mon Dec 10 23:31:50 EST 2012"
+ ts_pst = datetime(2012, 12, 10, 20, 31, 50)
+ query = "%s to pst" % s
+ self.assertEqual(ts_pst, wtftz.convert_free(query))
+
def test_sysdate_tz_doesnt_match(self):
# TODO: Make this test pass
s = "Mon Dec 10 23:31:50 EST 2012"
@@ -276,6 +282,14 @@ def test_extraction_no_from(self):
self._test_extraction(
query, self.est_ts_str, None, "US/Pacific")
+ def test_extraction_no_from_keyword(self):
+ query_template = "{ts} {fromz} to {toz}"
+ query = query_template.format(ts=self.est_ts_str,
+ fromz="EST",
+ toz="US/Pacific")
+ self._test_extraction(
+ query, self.est_ts_str, "EST", "US/Pacific")
+
class TestTimesWithoutDates(TestCase):
def test_simple_bare_times(self):

0 comments on commit e7d63b2

Please sign in to comment.