11import datetime
2- from typing import Literal
2+ from typing import Union
33
44from pydantic import Base64Bytes
55
99from scim2_models .annotations import Returned
1010from scim2_models .annotations import Uniqueness
1111from scim2_models .attributes import ComplexAttribute
12- from scim2_models .reference import ExternalReference
12+ from scim2_models .reference import URI
13+ from scim2_models .reference import External
1314from scim2_models .reference import Reference
14- from scim2_models .reference import URIReference
1515from scim2_models .resources .resource import Extension
1616from scim2_models .resources .resource import Resource
1717from scim2_models .resources .schema import Attribute
@@ -69,8 +69,7 @@ def test_make_group_model_from_schema(load_sample):
6969
7070 # Members.ref
7171 assert (
72- Members .get_field_root_type ("ref" )
73- == Reference [Literal ["User" ] | Literal ["Group" ]]
72+ Members .get_field_root_type ("ref" ) == Reference [Union ["User" , "Group" ]] # noqa: F821
7473 )
7574 assert not Members .get_field_multiplicity ("ref" )
7675 assert (
@@ -292,7 +291,7 @@ def test_make_user_model_from_schema(load_sample):
292291 assert User .get_field_annotation ("nick_name" , Uniqueness ) == Uniqueness .none
293292
294293 # profile_url
295- assert User .get_field_root_type ("profile_url" ) == Reference [ExternalReference ]
294+ assert User .get_field_root_type ("profile_url" ) == Reference [External ]
296295 assert not User .get_field_multiplicity ("profile_url" )
297296 assert (
298297 User .model_fields ["profile_url" ].description
@@ -642,7 +641,7 @@ def test_make_user_model_from_schema(load_sample):
642641 assert User .get_field_annotation ("photos" , Uniqueness ) == Uniqueness .none
643642
644643 # photo.value
645- assert Photos .get_field_root_type ("value" ) == Reference [ExternalReference ]
644+ assert Photos .get_field_root_type ("value" ) == Reference [External ]
646645 assert not Photos .get_field_multiplicity ("value" )
647646 assert Photos .model_fields ["value" ].description == "URL of a photo of the User."
648647 assert Photos .get_field_annotation ("value" , Required ) == Required .false
@@ -859,8 +858,7 @@ def test_make_user_model_from_schema(load_sample):
859858
860859 # group.ref
861860 assert (
862- Groups .get_field_root_type ("ref" )
863- == Reference [Literal ["User" ] | Literal ["Group" ]]
861+ Groups .get_field_root_type ("ref" ) == Reference [Union ["User" , "Group" ]] # noqa: F821
864862 )
865863 assert not Groups .get_field_multiplicity ("ref" )
866864 assert (
@@ -1396,7 +1394,7 @@ def test_make_enterprise_user_model_from_schema(load_sample):
13961394 assert Manager .get_field_annotation ("value" , Uniqueness ) == Uniqueness .none
13971395
13981396 # Manager.ref
1399- assert Manager .get_field_root_type ("ref" ) == Reference [Literal [ "User" ] ]
1397+ assert Manager .get_field_root_type ("ref" ) == Reference ["User" ]
14001398 assert not Manager .get_field_multiplicity ("ref" )
14011399 assert (
14021400 Manager .model_fields ["ref" ].description
@@ -1482,7 +1480,7 @@ def test_make_resource_type_model_from_schema(load_sample):
14821480 )
14831481
14841482 # endpoint
1485- assert ResourceType .get_field_root_type ("endpoint" ) == Reference [URIReference ]
1483+ assert ResourceType .get_field_root_type ("endpoint" ) == Reference [URI ]
14861484 assert not ResourceType .get_field_multiplicity ("endpoint" )
14871485 assert (
14881486 ResourceType .model_fields ["endpoint" ].description
@@ -1498,7 +1496,7 @@ def test_make_resource_type_model_from_schema(load_sample):
14981496 assert ResourceType .get_field_annotation ("endpoint" , Uniqueness ) == Uniqueness .none
14991497
15001498 # schema
1501- assert ResourceType .get_field_root_type ("schema_" ) == Reference [URIReference ]
1499+ assert ResourceType .get_field_root_type ("schema_" ) == Reference [URI ]
15021500 assert not ResourceType .get_field_multiplicity ("schema_" )
15031501 assert (
15041502 ResourceType .model_fields ["schema_" ].description
@@ -1543,7 +1541,7 @@ def test_make_resource_type_model_from_schema(load_sample):
15431541 )
15441542
15451543 # SchemaExtensions.schema
1546- assert SchemaExtensions .get_field_root_type ("schema_" ) == Reference [URIReference ]
1544+ assert SchemaExtensions .get_field_root_type ("schema_" ) == Reference [URI ]
15471545 assert not SchemaExtensions .get_field_multiplicity ("schema_" )
15481546 assert (
15491547 SchemaExtensions .model_fields ["schema_" ].description
@@ -1630,7 +1628,7 @@ def test_make_service_provider_config_model_from_schema(load_sample):
16301628 # documentation_uri
16311629 assert (
16321630 ServiceProviderConfig .get_field_root_type ("documentation_uri" )
1633- == Reference [ExternalReference ]
1631+ == Reference [External ]
16341632 )
16351633 assert not ServiceProviderConfig .get_field_multiplicity ("documentation_uri" )
16361634 assert (
@@ -2038,10 +2036,7 @@ def test_make_service_provider_config_model_from_schema(load_sample):
20382036 )
20392037
20402038 # authentication_schemes.spec_uri
2041- assert (
2042- AuthenticationSchemes .get_field_root_type ("spec_uri" )
2043- == Reference [ExternalReference ]
2044- )
2039+ assert AuthenticationSchemes .get_field_root_type ("spec_uri" ) == Reference [External ]
20452040 assert not AuthenticationSchemes .get_field_multiplicity ("spec_uri" )
20462041 assert (
20472042 AuthenticationSchemes .model_fields ["spec_uri" ].description
@@ -2071,7 +2066,7 @@ def test_make_service_provider_config_model_from_schema(load_sample):
20712066 # authentication_schemes.documentation_uri
20722067 assert (
20732068 AuthenticationSchemes .get_field_root_type ("documentation_uri" )
2074- == Reference [ExternalReference ]
2069+ == Reference [External ]
20752070 )
20762071 assert not AuthenticationSchemes .get_field_multiplicity ("documentation_uri" )
20772072 assert (
0 commit comments