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

feat: Add datetime and datetime_string matchers #2

Merged
merged 1 commit into from
Aug 11, 2024

Conversation

MartinGotelli
Copy link
Owner

Adding datetime and datetime string matchers:

    def _datetime_function():
        return {
            "data": "some data",
            "created_at": datetime.now(),
            "created_at_string": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
        }

    expected_value = {
        "data": "some data",
        "created_at": is_datetime(min_value=datetime.now()),
        "created_at_string": is_datetime_string("%Y-%m-%d %H:%M:%S", min_value=datetime.now()),
    }
    first_data = _datetime_function()
    assert first_data == expected_value
    second_data = _datetime_function()
    assert second_data == expected_value
    assert first_data != second_data

@MartinGotelli MartinGotelli merged commit 5881259 into main Aug 11, 2024
3 checks passed
@MartinGotelli MartinGotelli deleted the datetime-matcher branch February 11, 2025 01:23
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.

1 participant