fix: 포트 충돌 회피 — note_bridge 8098, intent_service 8099

Jellyfin(8096), OrbStack(8097) 포트 충돌으로 변경.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-19 13:53:55 +09:00
parent dc08d29509
commit c2257d3a86
2709 changed files with 619549 additions and 10 deletions

View File

@@ -0,0 +1 @@
"""Test the getters/setters of components."""

View File

@@ -0,0 +1,54 @@
"""Test the properties of the alarm."""
import pytest
from icalendar.cal import Alarm
from icalendar.error import InvalidCalendar
def test_repeat_absent():
"""Test the absence of REPEAT."""
assert Alarm().REPEAT == 0
def test_repeat_number():
"""Test the absence of REPEAT."""
assert Alarm({"REPEAT": 10}).REPEAT == 10
def test_set_REPEAT():
"""Check setting the value."""
a = Alarm()
a.REPEAT = 10
assert a.REPEAT == 10
def test_set_REPEAT_twice():
"""Check setting the value."""
a = Alarm()
a.REPEAT = 10
a.REPEAT = 20
assert a.REPEAT == 20
def test_add_REPEAT():
"""Check setting the value."""
a = Alarm()
a.add("REPEAT", 10)
assert a.REPEAT == 10
def test_invalid_repeat_value():
"""Check setting the value."""
a = Alarm()
with pytest.raises(ValueError):
a.REPEAT = "asd"
a["REPEAT"] = "asd"
with pytest.raises(InvalidCalendar):
a.REPEAT # noqa: B018
def test_alarm_to_string():
a = Alarm()
a.REPEAT = 11
assert a.to_ical() == b"BEGIN:VALARM\r\nREPEAT:11\r\nEND:VALARM\r\n"

View File

@@ -0,0 +1,92 @@
"""Test common properties of components."""
from datetime import date, datetime, timedelta
import pytest
from icalendar import Event, FreeBusy, Journal, Todo, vDDDTypes
from icalendar.cal import Component
from icalendar.error import InvalidCalendar
@pytest.fixture(params=[Event, Todo, Journal, FreeBusy])
def dtstamp_comp(request):
"""a component to test"""
return request.param()
def test_no_dtstamp(dtstamp_comp):
"""We have None as a value."""
assert dtstamp_comp.DTSTAMP is None
def set_dtstamp_attribute(component: Component, value: date):
"""Use the setter."""
component.DTSTAMP = value
def set_dtstamp_item(component: Component, value: date):
"""Use setitem."""
component["DTSTAMP"] = vDDDTypes(value)
def set_dtstamp_add(component: Component, value: date):
"""Use add."""
component.add("DTSTAMP", value)
@pytest.mark.parametrize(
("value", "timezone", "expected"),
[
(datetime(2024, 10, 11, 23, 1), None, datetime(2024, 10, 11, 23, 1)),
(datetime(2024, 10, 11, 23, 1), "Europe/Berlin", datetime(2024, 10, 11, 21, 1)),
(datetime(2024, 10, 11, 22, 1), "UTC", datetime(2024, 10, 11, 22, 1)),
(date(2024, 10, 10), None, datetime(2024, 10, 10)),
],
)
@pytest.mark.parametrize(
"set_dtstamp", [set_dtstamp_add, set_dtstamp_attribute, set_dtstamp_item]
)
def test_set_value_and_get_it(
dtstamp_comp, value, timezone, expected, tzp, set_dtstamp
):
"""Set and get the DTSTAMP value."""
dtstamp = value if timezone is None else tzp.localize(value, timezone)
set_dtstamp(dtstamp_comp, dtstamp)
in_utc = tzp.localize_utc(expected)
get_value = dtstamp_comp.get("DTSTAMP").dt
assert in_utc == get_value or set_dtstamp != set_dtstamp_attribute
assert in_utc == dtstamp_comp.DTSTAMP
@pytest.mark.parametrize("invalid_value", [None, timedelta()])
def test_set_invalid_value(invalid_value, dtstamp_comp):
"""Check handling of invalid values."""
with pytest.raises(TypeError) as e:
dtstamp_comp.DTSTAMP = invalid_value
assert e.value.args[0] == f"DTSTAMP takes a datetime in UTC, not {invalid_value}"
@pytest.mark.parametrize("invalid_value", [None, vDDDTypes(timedelta())])
def test_get_invalid_value(invalid_value, dtstamp_comp):
"""Check handling of invalid values."""
dtstamp_comp["DTSTAMP"] = invalid_value
with pytest.raises(InvalidCalendar) as e:
dtstamp_comp.DTSTAMP # noqa: B018
assert (
e.value.args[0]
== f"DTSTAMP must be a datetime in UTC, not {getattr(invalid_value, 'dt', invalid_value)}"
)
def test_set_twice(dtstamp_comp, tzp):
"""Set the value twice."""
dtstamp_comp.DTSTAMP = date(2014, 1, 1)
dtstamp_comp.DTSTAMP = date(2014, 1, 2)
assert tzp.localize_utc(datetime(2014, 1, 2)) == dtstamp_comp.DTSTAMP
def test_last_modified(dtstamp_comp, tzp):
"""Check we can set LAST_MODIFIED in the same way as DTSTAMP"""
dtstamp_comp.LAST_MODIFIED = date(2014, 1, 2)
assert tzp.localize_utc(datetime(2014, 1, 2)) == dtstamp_comp.LAST_MODIFIED

View File

@@ -0,0 +1,62 @@
"""This tests the exdate property.
"""
from __future__ import annotations
from datetime import date, datetime
from pprint import pprint
from typing import Union
import pytest
from icalendar import (
Calendar,
Event,
Journal,
TimezoneDaylight,
TimezoneStandard,
Todo,
)
C_EXDATE = Union[Event, Todo, Journal, TimezoneDaylight, TimezoneStandard]
@pytest.fixture(params = [Event, Todo, Journal, TimezoneDaylight, TimezoneStandard])
def c_exdate(request) -> C_EXDATE:
"""Return a component that uses exdate."""
return request.param()
@pytest.fixture(
params=[
lambda _tzp: date(2019, 10, 11),
lambda _tzp: datetime(2000, 1, 13, 12, 1),
lambda tzp: tzp.localize_utc(datetime(2031, 12, 1, 23, 59)),
lambda tzp: tzp.localize(datetime(1984, 1, 13, 13, 1), "Europe/Athens"),
]
)
def exdate(request, tzp):
"""Possible values for an exdate."""
return request.param(tzp)
def test_no_exdates_by_default(c_exdate):
"""We expect no exdate by default."""
assert c_exdate.exdates == []
def test_set_and_retrieve_exdate(exdate, c_exdate):
"""Set the attribute and get the value."""
c_exdate.add("exdate", [exdate])
result = [exdate]
assert c_exdate.exdates == result
def test_set_and_retrieve_exdates_in_list(exdate, c_exdate):
"""Set the attribute and get the value."""
c_exdate.add("exdate", [exdate, exdate])
result = [exdate, exdate]
assert c_exdate.exdates == result
def test_set_and_retrieve_exdates_twice(exdate, c_exdate):
"""Set the attribute and get the value."""
c_exdate.add("exdate", [exdate])
c_exdate.add("exdate", [exdate])
result = [exdate, exdate]
assert c_exdate.exdates == result

View File

@@ -0,0 +1,111 @@
"""This tests the RDATE property.
"""
from __future__ import annotations
from datetime import date, datetime
from pprint import pprint
from typing import Union
import pytest
from icalendar import (
Calendar,
Event,
Journal,
TimezoneDaylight,
TimezoneStandard,
Todo,
)
C_RDATE = Union[Event, Todo, Journal, TimezoneDaylight, TimezoneStandard]
@pytest.fixture(params = [Event, Todo, Journal, TimezoneDaylight, TimezoneStandard])
def c_rdate(request) -> C_RDATE:
"""Return a component that uses RDATE."""
return request.param()
@pytest.fixture(
params=[
lambda _tzp: date(2019, 10, 11),
lambda _tzp: datetime(2000, 1, 13, 12, 1),
lambda tzp: tzp.localize_utc(datetime(2031, 12, 1, 23, 59)),
lambda tzp: tzp.localize(datetime(1984, 1, 13, 13, 1), "Europe/Athens"),
lambda _tzp: ((datetime(2000, 1, 13, 12, 1), datetime(2000, 1, 13, 12, 2))),
lambda tzp: ((tzp.localize_utc(datetime(2001, 1, 13, 12, 1)), tzp.localize_utc(datetime(2001, 1, 13, 12, 2)))),
]
)
def rdate(request, tzp):
"""Possible values for an rdate."""
return request.param(tzp)
def test_no_rdates_by_default(c_rdate):
"""We expect no rdate by default."""
assert c_rdate.rdates == []
def test_set_and_retrieve_rdate(rdate, c_rdate):
"""Set the attribute and get the value."""
c_rdate.add("RDATE", [rdate])
result = [rdate if isinstance(rdate, tuple) else (rdate, None)]
assert c_rdate.rdates == result
def test_get_example_0(calendars):
"""Test an example rdate."""
cal : Calendar = calendars.rfc_5545_RDATE_example
event = cal.events[0]
assert event.rdates == [(datetime(1997, 7, 14, 12, 30), None)]
def test_get_example_1(calendars, tzp):
"""Test an example rdate."""
cal : Calendar = calendars.rfc_5545_RDATE_example
event = cal.events[1]
assert event.rdates == [(tzp.localize_utc(datetime(1997, 7, 14, 12, 30)), None)]
def test_get_example_2(calendars, tzp):
"""Test an example rdate."""
cal : Calendar = calendars.rfc_5545_RDATE_example
event = cal.events[2]
assert event.rdates == [(tzp.localize(datetime(1997, 7, 14, 8, 30), "America/New_York"),None)]
def test_get_example_3(calendars, tzp):
"""Test an example rdate."""
cal : Calendar = calendars.rfc_5545_RDATE_example
event = cal.events[3]
rdates_3 = [
(tzp.localize_utc(datetime(1996, 4, 3, 2)), tzp.localize_utc(datetime(1996, 4, 3, 4))),
(tzp.localize_utc(datetime(1996, 4, 4, 1)), tzp.localize_utc(datetime(1996, 4, 4, 4))),
]
pprint(event.rdates)
pprint(rdates_3)
assert event.rdates == rdates_3
def d(i:int) -> tuple[date, None]:
s = str(i)
return (date(int(s[:4]), int(s[4:6].lstrip("0")), int(s[6:].lstrip("0"))), None)
RDATES_4 = list(map(d, (
19970101,
19970120,
19970217,
19970421,
19970526,
19970704,
19970901,
19971014,
19971128,
19971129,
19971225,
)))
def test_get_example_4(calendars, tzp):
"""Test an example rdate."""
cal : Calendar = calendars.rfc_5545_RDATE_example
event = cal.events[4]
pprint(event.rdates)
pprint(RDATES_4)
assert event.rdates == RDATES_4

View File

@@ -0,0 +1,45 @@
"""Test getting the rrules from a component."""
import pytest
from icalendar import (
Component,
Event,
Journal,
TimezoneDaylight,
TimezoneStandard,
Todo,
vRecur,
)
RRULE_0 = vRecur.from_ical("FREQ=DAILY;COUNT=10")
RRULE_1 = vRecur.from_ical("FREQ=DAILY;UNTIL=19971224T000000Z")
RRULE_2 = vRecur.from_ical("FREQ=DAILY;INTERVAL=2")
RRULE_3 = vRecur.from_ical("FREQ=DAILY;INTERVAL=10;COUNT=5")
RRULE_4 = vRecur.from_ical("FREQ=YEARLY;UNTIL=20000131T140000Z;BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA")
@pytest.fixture(params=[RRULE_0, RRULE_1, RRULE_2, RRULE_3, RRULE_4])
def rrule(request) -> str:
"""An rrule."""
return request.param
@pytest.fixture(params = [Event, Todo, Journal, TimezoneDaylight, TimezoneStandard])
def c_rrule(request) -> Component:
"""Return a component that uses RDATE."""
return request.param()
def test_no_rrules_by_default(c_rrule):
"""We expect no rdate by default."""
assert c_rrule.rrules == []
def test_one_rrule(c_rrule, rrule):
"""Add one rrule."""
c_rrule.add("rrule", rrule)
assert c_rrule.rrules == [rrule]
def test_two_rrules(c_rrule, rrule):
"""Add two rrules."""
c_rrule.add("rrule", rrule)
c_rrule.add("rrule", RRULE_3)
assert c_rrule.rrules == [rrule, RRULE_3]