Skip to content

BUG: Resolve passing datetime strings of the form "1-01-01 00:00:00" #37070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pandas/tests/scalar/timestamp/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ def test_construct_with_different_string_format(self, arg):
expected = Timestamp(datetime(2013, 1, 1), tz=pytz.FixedOffset(540))
assert result == expected

@pytest.mark.parametrize(
"arg", ["1-01-01 00:00:00", "3-01-01 00:00:00", "100-01-01 00:00:00"]
)
def test_construct_with_different_string_format_short_year(self, arg):
with pytest.raises(OutOfBoundsDatetime, match=arg):
Timestamp(arg)

def test_construct_timestamp_preserve_original_frequency(self):
# GH 22311
result = Timestamp(Timestamp("2010-08-08", freq="D")).freq
Expand Down