2024-06-28 23:03:51 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2022-03-27 05:45:37 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from pybind11_tests import const_name as m
|
|
|
|
|
|
|
|
|
|
|
2023-10-07 00:21:06 +08:00
|
|
|
@pytest.mark.parametrize("func", [m.const_name_tests, m.underscore_tests])
|
2022-03-27 05:45:37 +08:00
|
|
|
@pytest.mark.parametrize(
|
2023-10-07 00:21:06 +08:00
|
|
|
("selector", "expected"),
|
2022-03-27 05:45:37 +08:00
|
|
|
enumerate(
|
|
|
|
|
(
|
|
|
|
|
"",
|
|
|
|
|
"A",
|
|
|
|
|
"Bd",
|
|
|
|
|
"Cef",
|
|
|
|
|
"%",
|
|
|
|
|
"%",
|
|
|
|
|
"T1",
|
|
|
|
|
"U2",
|
|
|
|
|
"D1",
|
|
|
|
|
"E2",
|
|
|
|
|
"KeepAtEnd",
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
def test_const_name(func, selector, expected):
|
2022-10-29 01:10:19 +08:00
|
|
|
if isinstance(func, str):
|
2022-03-27 05:45:37 +08:00
|
|
|
pytest.skip(func)
|
|
|
|
|
text = func(selector)
|
|
|
|
|
assert text == expected
|