File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ def __init__(
229
229
self .RedisDsn = RedisDsn
230
230
self .parse_obj_as = parse_obj_as
231
231
self .ValidationError = ValidationError
232
- self .pydantic_version = version .VERSION
232
+ self .pydantic_version = tuple (map (int , version .VERSION .split ('.' )))
233
+
233
234
except ImportError as e :
234
235
raise ImportError ('pydantic is not installed, run `pip install dirty-equals[pydantic]`' ) from e
235
236
url_type_mappings = {
@@ -264,7 +265,11 @@ def equals(self, other: Any) -> bool:
264
265
except self .ValidationError :
265
266
raise ValueError ('Invalid URL' )
266
267
267
- equal = parsed == other if self .pydantic_version < '2' else parsed .unicode_string () == other
268
+ if self .pydantic_version [0 ] == 1 : # checking major version
269
+ equal = parsed == other
270
+ else :
271
+ equal = parsed .unicode_string () == other
272
+
268
273
if not self .attribute_checks :
269
274
return equal
270
275
You can’t perform that action at this time.
0 commit comments