File: test_diagnostics.py

package info (click to toggle)
python-ical 9.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,448 kB
  • sloc: python: 13,877; sh: 9; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 736 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Tests for diagnostics."""

import pathlib
import pytest

from ical.diagnostics import redact_ics
from syrupy import SnapshotAssertion


def test_empty() -> None:
    """Test redaction of an empty ics file."""
    assert list(redact_ics("")) == []
    assert list(redact_ics("\n")) == []


@pytest.mark.parametrize(
    ("filename"),
    [
        ("tests/testdata/datetime_timezone.ics"),
        ("tests/testdata/description_altrep.ics"),
    ],
    ids=("datetime_timezone", "description_altrep"),
)
def test_redact_date_timezone(filename: str, snapshot: SnapshotAssertion) -> None:
    """Test redaction of an empty ics file."""
    ics = pathlib.Path(filename).read_text()
    assert "\n".join(list(redact_ics(ics))) == snapshot