File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ def __init__(
229229 self .RedisDsn = RedisDsn
230230 self .parse_obj_as = parse_obj_as
231231 self .ValidationError = ValidationError
232- self .pydantic_version = version .VERSION
232+ self .pydantic_version = tuple (map (int , version .VERSION .split ('.' )))
233+
233234 except ImportError as e :
234235 raise ImportError ('pydantic is not installed, run `pip install dirty-equals[pydantic]`' ) from e
235236 url_type_mappings = {
@@ -264,7 +265,11 @@ def equals(self, other: Any) -> bool:
264265 except self .ValidationError :
265266 raise ValueError ('Invalid URL' )
266267
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+
268273 if not self .attribute_checks :
269274 return equal
270275
You can’t perform that action at this time.
0 commit comments