(self, other)
| 1043 | return result |
| 1044 | |
| 1045 | def __eq__(self, other): |
| 1046 | if other is None: |
| 1047 | return False |
| 1048 | for constraint, value in self.options.items(): |
| 1049 | try: |
| 1050 | if constraint == "enumeration": |
| 1051 | if other not in [cast_to_value(v, other) for v in value]: |
| 1052 | return False |
| 1053 | elif constraint == "pattern": |
| 1054 | if not isinstance(other, str): |
| 1055 | return False |
| 1056 | value = value if isinstance(value, list) else [value] |
| 1057 | for pattern in value: |
| 1058 | if re.compile(identities.translate_pattern(pattern)).fullmatch(other) is None: |
| 1059 | return False |
| 1060 | elif constraint == "length": |
| 1061 | if len(str(other)) != int(value): |
| 1062 | return False |
| 1063 | elif constraint == "maxLength": |
| 1064 | if len(str(other)) > int(value): |
| 1065 | return False |
| 1066 | elif constraint == "minLength": |
| 1067 | if len(str(other)) < int(value): |
| 1068 | return False |
| 1069 | elif constraint == "maxExclusive": |
| 1070 | if float(other) >= float(value): |
| 1071 | return False |
| 1072 | elif constraint == "maxInclusive": |
| 1073 | if float(other) > float(value): |
| 1074 | return False |
| 1075 | elif constraint == "minExclusive": |
| 1076 | if float(other) <= float(value): |
| 1077 | return False |
| 1078 | elif constraint == "minInclusive": |
| 1079 | if float(other) < float(value): |
| 1080 | return False |
| 1081 | except ValueError: |
| 1082 | return False |
| 1083 | return True |
| 1084 | |
| 1085 | def __str__(self): |
| 1086 | return str(self.options) |
nothing calls this directly
no test coverage detected