Files
wehub-resource-sync 09e9f3545f
CodeQL / Analyze (push) Waiting to run
dependency-audit / pip-audit (push) Waiting to run
Test / Code Quality (push) Has been cancelled
Test / Test (macos-latest, Python 3.10) (push) Has been cancelled
Test / Test (macos-latest, Python 3.11) (push) Has been cancelled
Test / Test (macos-latest, Python 3.12) (push) Has been cancelled
Test / Test (macos-latest, Python 3.13) (push) Has been cancelled
Test / Test (macos-latest, Python 3.14) (push) Has been cancelled
Test / Test (ubuntu-latest, Python 3.10) (push) Has been cancelled
Test / Test (ubuntu-latest, Python 3.11) (push) Has been cancelled
Test / Test (ubuntu-latest, Python 3.12) (push) Has been cancelled
Test / Test (ubuntu-latest, Python 3.13) (push) Has been cancelled
Test / Test (ubuntu-latest, Python 3.14) (push) Has been cancelled
Test / Test (windows-latest, Python 3.10) (push) Has been cancelled
Test / Test (windows-latest, Python 3.11) (push) Has been cancelled
Test / Test (windows-latest, Python 3.12) (push) Has been cancelled
Test / Test (windows-latest, Python 3.13) (push) Has been cancelled
Test / Test (windows-latest, Python 3.14) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:30:13 +08:00

39 lines
1.1 KiB
Python

"""Tests for the Label value type and its from_api_response builder."""
from __future__ import annotations
import pytest
from notebooklm._types.labels import Label
from notebooklm.exceptions import UnknownRPCMethodError
def test_from_api_response_populated() -> None:
label = Label.from_api_response(
["Topic", [["s1"], ["s2"]], "l1", "\U0001f4c1"],
notebook_id="nb_1",
method_id="agX4Bc",
)
assert label.id == "l1"
assert label.name == "Topic"
assert label.notebook_id == "nb_1"
assert label.emoji == "\U0001f4c1"
assert label.source_ids == ["s1", "s2"]
def test_empty_emoji_becomes_none() -> None:
label = Label.from_api_response(["Topic", None, "l1", ""])
assert label.emoji is None
assert label.source_ids == []
assert label.notebook_id is None
def test_notebook_id_is_keyword_only() -> None:
with pytest.raises(TypeError):
Label.from_api_response(["Topic", None, "l1", ""], "nb_1") # type: ignore[misc]
def test_drift_propagates_from_row_adapter() -> None:
with pytest.raises(UnknownRPCMethodError):
Label.from_api_response(["Topic", None, 5, ""])