fix(jambo): Add support for file-path format in StringTypeParser (#7)

This commit is contained in:
Thomas
2025-07-07 17:31:33 +02:00
committed by GitHub
parent 45018eadd1
commit 053279ba95
2 changed files with 16 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
from jambo.parser import StringTypeParser
from pydantic import EmailStr, HttpUrl, IPvAnyAddress
from pydantic import EmailStr, HttpUrl, IPvAnyAddress, FilePath
from datetime import date, datetime, time
from unittest import TestCase
@@ -159,6 +159,18 @@ class TestStringTypeParser(TestCase):
type_validator["pattern"], parser.format_pattern_mapping[format_type]
)
def test_string_parser_with_file_path_format(self):
parser = StringTypeParser()
properties = {
"type": "string",
"format": "file-path",
}
type_parsing, type_validator = parser.from_properties("placeholder", properties)
self.assertEqual(type_parsing, FilePath)
def test_string_parser_with_unsupported_format(self):
parser = StringTypeParser()