SharedDocsLib/tests/test_ui.py
2026-08-09 17:59:49 +00:00

19 lines
579 B
Python

import pytest
from docslib import HeaderButton
def test_header_button_validation_and_factories():
local = HeaderButton("Introduction", "1")
assert local.page == "1"
assert local.href is None
external = HeaderButton.external("GitHub", "https://github.com/")
assert external.href == "https://github.com/"
assert external.new_tab is True
with pytest.raises(ValueError, match="exactly one"):
HeaderButton("Broken")
with pytest.raises(ValueError, match="exactly one"):
HeaderButton("Broken", page="1", href="https://example.com")