Skip to content
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

Datetime features #729

Merged
merged 10 commits into from
Sep 26, 2022
Merged

Datetime features #729

merged 10 commits into from
Sep 26, 2022

Conversation

prescod
Copy link
Contributor

@prescod prescod commented Sep 15, 2022

Add datetime_between feature
Allow datetimes to be parsed from strings
Allow datetimes to be coerced from dates

@prescod prescod requested a review from a team as a code owner September 15, 2022 06:00
@prescod prescod marked this pull request as draft September 15, 2022 16:34
@prescod prescod marked this pull request as ready for review September 15, 2022 19:51
@prescod prescod force-pushed the feature/create-date-time-from-date branch from 5eda3c5 to c481d50 Compare September 23, 2022 19:49
start_date: 1999-12-31 11:59:00
end_date: now
timezone:
relativedelta:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other options besides relativedelta? Is there a syntax to specify a timezone with a traditional abbreviation? (e.g. timezone: PST)

basedate: ${{datetime("2022-01-01", year=2000, month=1, day=1)}}
dateplus: ${{basedate + "XYZZY"}}
"""
with pytest.raises(exc.DataGenValueError) as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could save a line by using the match argument. My regex-fu could be off here though :)

Suggested change
with pytest.raises(exc.DataGenValueError) as e:
with pytest.raises(exc.DataGenValueError, match=r'/date specification/') as e:

with pytest.raises(exc.DataGenError) as e:
generate(StringIO(yaml), {}, None)

assert "date specification" in str(e.value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@prescod prescod merged commit 2a5be36 into main Sep 26, 2022
@prescod prescod deleted the feature/create-date-time-from-date branch September 26, 2022 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants