-
-
Notifications
You must be signed in to change notification settings - Fork 175
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 #750 from david-venhoff/main
- Loading branch information
Showing
4 changed files
with
59 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
from icalendar.prop import vWeekday | ||
|
||
|
||
def test_simple(): | ||
weekday = vWeekday("SU") | ||
assert weekday.to_ical() == b"SU" | ||
assert weekday.weekday == "SU" | ||
assert weekday.relative is None | ||
|
||
|
||
def test_relative(): | ||
weekday = vWeekday("-1MO") | ||
assert weekday.to_ical() == b"-1MO" | ||
assert weekday.weekday == "MO" | ||
assert weekday.relative == -1 | ||
|
||
|
||
def test_roundtrip(): | ||
assert vWeekday.from_ical(vWeekday("+2TH").to_ical()) == "+2TH" | ||
|
||
|
||
def test_error(): | ||
"""Error: Expected weekday abbrevation, got: \"-100MO\" """ | ||
with pytest.raises(ValueError): | ||
vWeekday.from_ical("-100MO") |