25
25
('c0a8f9a8-aa5e-482b-a067-9cb3a51f5c11' , UUID ('c0a8f9a8-aa5e-482b-a067-9cb3a51f5c11' )),
26
26
(b'\x12 \x34 \x56 \x78 ' * 4 , UUID ('12345678-1234-5678-1234-567812345678' )),
27
27
(b'\x00 \x00 \x00 \x00 ' * 4 , UUID ('00000000-0000-0000-0000-000000000000' )),
28
+ (UUID ('12345678-1234-5678-1234-567812345678' ), UUID ('12345678-1234-5678-1234-567812345678' )),
29
+ (UUID ('550e8400-e29b-41d4-a716-446655440000' ), UUID ('550e8400-e29b-41d4-a716-446655440000' )),
28
30
# Invalid UUIDs
29
31
(
30
32
'not-a-valid-uuid' ,
67
69
'c0a8f9a8-aa5e-482b-a067-9cb3a51f5c1' ,
68
70
Err ('Input should be a valid UUID, invalid group length in group 4: expected 12, found 11' ),
69
71
),
72
+ (0xA1A2A3A4B1B2C1C2D1D2D3D4D5D6D7D8 , Err ('UUID input should be a string, bytes or UUID object' )),
73
+ (00000000000000000000000000 , Err ('UUID input should be a string, bytes or UUID object' )),
70
74
],
71
75
)
72
76
def test_uuid (input_value , expected ):
@@ -78,6 +82,7 @@ def test_uuid(input_value, expected):
78
82
else :
79
83
output = v .validate_python (input_value )
80
84
assert output == expected
85
+ assert isinstance (output , UUID )
81
86
82
87
83
88
@pytest .mark .parametrize (
@@ -97,6 +102,7 @@ def test_uuid_strict(input_value, expected):
97
102
else :
98
103
output = v .validate_python (input_value )
99
104
assert output == expected
105
+ assert isinstance (output , UUID )
100
106
101
107
102
108
@pytest .mark .parametrize (
@@ -122,6 +128,7 @@ def test_uuid_version(input_value, version, expected):
122
128
else :
123
129
output = v .validate_python (input_value )
124
130
assert output == expected
131
+ assert isinstance (output , UUID )
125
132
126
133
127
134
@pytest .mark .parametrize (
@@ -148,17 +155,20 @@ def test_uuid_json(py_and_json: PyAndJson, input_value, expected):
148
155
else :
149
156
output = v .validate_test (input_value )
150
157
assert output == expected
158
+ assert isinstance (output , UUID )
151
159
152
160
153
161
def test_uuid_deepcopy ():
154
162
output = SchemaValidator ({'type' : 'uuid' }).validate_python ('a6cc5730-2261-11ee-9c43-2eb5a363657c' )
155
163
c = copy .deepcopy (output )
156
164
assert repr (output ) == "UUID('a6cc5730-2261-11ee-9c43-2eb5a363657c')"
157
165
assert c == output
166
+ assert isinstance (output , UUID )
158
167
159
168
160
169
def test_uuid_copy ():
161
170
output = SchemaValidator ({'type' : 'uuid' }).validate_python ('a6cc5730-2261-11ee-9c43-2eb5a363657c' )
162
171
c = copy .copy (output )
163
172
assert repr (output ) == "UUID('a6cc5730-2261-11ee-9c43-2eb5a363657c')"
164
173
assert c == output
174
+ assert isinstance (output , UUID )
0 commit comments