Added snippet for datetime

pull/57/head
Donne Martin 2015-01-24 07:54:57 -05:00
parent a5b6a3735f
commit 9d92a16ea5
2 changed files with 39 additions and 0 deletions

5
core/date_util.py Normal file
View File

@ -0,0 +1,5 @@
class DateUtil:
@classmethod
def Foo(cls):
pass

View File

@ -0,0 +1,34 @@
from nose.tools import assert_equal
from datetime import datetime, date, time
class TestDateUtil():
@classmethod
def setup_class(cls):
"""This method is run once for each class before any tests are run"""
@classmethod
def teardown_class(cls):
"""This method is run once for each class _after_ all tests are run"""
def setUp(self):
"""This method is run once before _each_ test method is executed"""
def teardown(self):
"""This method is run once after _each_ test method is executed"""
year = 2015
month = 1
day = 20
hour = 7
minute = 28
second = 15
def test_datetime(self):
dt = datetime(self.year, self.month, self.day,
self.hour, self.minute, self.second)
assert_equal(dt.day, self.day)
assert_equal(dt.minute, self.minute)
assert_equal(dt.date(), date(self.year, self.month, self.day))
assert_equal(dt.time(), time(self.hour, self.minute, self.second))