Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from collective/issue-318-skip-value-paramete…
…r-for-default-date-time Remove VALUE=DATE-TIME from DTSTART, DTEND, DTSTAMP
- Loading branch information
Showing
8 changed files
with
58 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/icalendar/tests/test_issue_318_skip_default_parameters.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Some parameters are specified as default by the RFC 5545. | ||
These tests make sure that these parameter values are not added to the | ||
properties. | ||
Example: | ||
DTSTART;VALUE=DATE-TIME:20190616T050000Z | ||
equals DTSTART:20190616T050000Z | ||
""" | ||
import pytest | ||
from icalendar import Event | ||
from datetime import datetime | ||
|
||
|
||
@pytest.mark.parametrize("attr", [ | ||
"DTSTART", | ||
"DTEND", | ||
"DTSTAMP", | ||
]) | ||
def test_datetime_in_event(attr): | ||
"""Check that the "VALUE=DATE-TIME" is absent because not needed.""" | ||
event = Event() | ||
event.add(attr, datetime(2022, 10, 13, 9, 16, 42)) | ||
ics = event.to_ical() | ||
assert b"VALUE=DATE-TIME" not in ics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters