def test_to_unix_timestamp_error(self): try: to_unix_timestamp(None, "%Y-%m-%d %H:%M:%S") assert False except: assert True try: to_unix_timestamp("1970-01-01 12:00:00", None) assert False except: assert True
def test_to_unix_timestamp(self): assert 0 == to_unix_timestamp("1970-01-01 12:00:00", "%Y-%m-%d %H:%M:%S") assert 1284101485 == to_unix_timestamp("2010-09-10 18:51:25","%Y-%m-%d %H:%M:%S")