Initial Const Implementation

This commit is contained in:
2025-06-22 22:13:46 -03:00
parent 42a1ae24fe
commit 65a81a8da5
5 changed files with 87 additions and 12 deletions

View File

@@ -0,0 +1,23 @@
from typing_extensions import Annotated, get_args, get_origin
from webbrowser import get
from jambo.parser import ConstTypeParser
from unittest import TestCase
class TestConstTypeParser(TestCase):
def test_parse_const_type(self):
parser = ConstTypeParser()
expected_const_value = "United States of America"
properties = {
"const": expected_const_value
}
parsed_type, parsed_properties = parser.from_properties(
"country", properties
)
self.assertEqual(get_origin(parsed_type), Annotated)
self.assertIn(str, get_args(parsed_type))