openai/chatkit-python
Publicmirrored fromhttps://github.com/openai/chatkit-pythonAvailable
tests/test_icons.py
22lines · modecode
| 1 | import pytest |
| 2 | from pydantic import TypeAdapter, ValidationError |
| 3 | |
| 4 | from chatkit.icons import IconName |
| 5 | |
| 6 | |
| 7 | def test_vendor_icon_names_are_valid(): |
| 8 | """Icon names prefixed with `vendor:` are valid.""" |
| 9 | TypeAdapter(IconName).validate_python("vendor:icon-name") |
| 10 | TypeAdapter(IconName).validate_python("vendor:another-icon-name") |
| 11 | |
| 12 | |
| 13 | def test_literal_icon_names_are_valid(): |
| 14 | """Spot check some literal icon names.""" |
| 15 | TypeAdapter(IconName).validate_python("book-open") |
| 16 | TypeAdapter(IconName).validate_python("phone") |
| 17 | TypeAdapter(IconName).validate_python("user") |
| 18 | |
| 19 | |
| 20 | def test_invalid_icon_names_are_rejected(): |
| 21 | with pytest.raises(ValidationError): |
| 22 | TypeAdapter(IconName).validate_python("invalid-icon") |
| 23 | |