Skip to content

Commit 4ddb387

Browse files
committed
tests: get_field_root_type tests accessing Reference
1 parent a8d7f93 commit 4ddb387

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_model_attributes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from scim2_models.context import Context
99
from scim2_models.messages.error import Error
1010
from scim2_models.messages.patch_op import PatchOp
11+
from scim2_models.reference import Reference
1112
from scim2_models.resources.enterprise_user import EnterpriseUser
1213
from scim2_models.resources.resource import Extension
1314
from scim2_models.resources.resource import Meta
@@ -25,12 +26,16 @@ class Sup(Resource):
2526
dummy: str
2627
sub: Sub
2728
subs: list[Sub]
29+
ref: Reference[Sub]
30+
refunion: Reference[Sub | User]
2831

2932

3033
def test_guess_root_type():
3134
assert Sup.get_field_root_type("dummy") is str
3235
assert Sup.get_field_root_type("sub") == Sub
3336
assert Sup.get_field_root_type("subs") == Sub
37+
assert Sup.get_field_root_type("ref") == Reference[Sub]
38+
assert Sup.get_field_root_type("refunion") == Reference[Sub | User]
3439

3540

3641
class ReturnedModel(BaseModel):

0 commit comments

Comments
 (0)