Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 829430e

Browse files
committed
Add typing and fix a type issue in _Error._matches_type
1 parent 90310be commit 829430e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

jsonschema/exceptions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,18 @@ def _contents(self):
152152
)
153153
return dict((attr, getattr(self, attr)) for attr in attrs)
154154

155-
def _matches_type(self):
155+
def _matches_type(self) -> bool:
156+
if isinstance(self.schema, _utils.Unset):
157+
return False
158+
156159
try:
157160
expected = self.schema["type"]
158161
except (KeyError, TypeError):
159162
return False
160163

164+
if isinstance(self._type_checker, _utils.Unset):
165+
return False
166+
161167
if isinstance(expected, str):
162168
return self._type_checker.is_type(self.instance, expected)
163169

0 commit comments

Comments
 (0)