Skip to content

Commit

Permalink
add timestamp value test
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Jul 1, 2016
1 parent c828847 commit 9791344
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_builder.py
Expand Up @@ -73,6 +73,18 @@ def test_set_timestamp_from_pandas_timestamp_with_ns_offset(self):
assert_that(timestamp.tzinfo, is_(equal_to(pytz.timezone('CET'))))
assert_that(timestamp.nanosecond, is_(equal_to(423)))

def test_value_property(self):
timestamp = self.builder.set_timestamp(datetime.datetime(2012, 2, 10, 12, 56, 18, 96651)).build()

value = timestamp.value
assert_that(value, is_(equal_to(1328878578096651000)))

def test_value_property_with_nanoseconds(self):
timestamp = self.builder.set_timestamp(datetime.datetime(2012, 2, 10, 12, 56, 18, 96651), 456).build()

value = timestamp.value
assert_that(value, is_(equal_to(1328878578096651456)))

def test_set_timestamp_from_bad_string(self):
timestamp = self.builder.set_timestamp('0000-00-00').build()
assert_that(timestamp.value, is_(pd.NaT.value))
Expand Down

0 comments on commit 9791344

Please sign in to comment.