def test_parse_datetime(): now = datetime.now() today = date.today() date_fmt1 = "2016-12-31" date_fmt2 = "2016-12-31 15:40:34.404540" date_fmt3 = "12/31/2016" assert parse_datetime(now) == now assert parse_datetime(today) == datetime.combine(today, datetime.min.time()) assert parse_datetime(date_fmt1) == datetime(2016, 12, 31) assert parse_datetime(date_fmt2) == datetime(2016, 12, 31, 15, 40, 34, 404540) assert parse_datetime(date_fmt3) == datetime(2016, 12, 31)