def test_normalize_date(): value = date(2012, 9, 7) result = tslibs.normalize_date(value) assert (result == datetime(2012, 9, 7)) value = datetime(2012, 9, 7, 12) result = tslibs.normalize_date(value) assert (result == datetime(2012, 9, 7)) value = datetime(2007, 10, 1, 1, 12, 5, 10) actual = tslibs.normalize_date(value) assert actual == datetime(2007, 10, 1)
def _maybe_normalize_endpoints(start, end, normalize): _normalized = True if start is not None: if normalize: start = normalize_date(start) _normalized = True else: _normalized = _normalized and start.time() == _midnight if end is not None: if normalize: end = normalize_date(end) _normalized = True else: _normalized = _normalized and end.time() == _midnight return start, end, _normalized
def test_normalize_date_sub_types(dt, expected): # GH 25851 # ensure that subclassed datetime works with # normalize_date result = tslibs.normalize_date(dt) assert result == expected
def test_normalize_date(value, expected): result = tslibs.normalize_date(value) assert result == expected