diff options
author | Julian Berman <Julian@GrayVines.com> | 2023-03-15 14:51:09 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2023-03-15 14:51:09 -0400 |
commit | 4f0ef528d482968f3648ae8ad535b9dd62f655ad (patch) | |
tree | d47c698918fc15c78bdd0b7e5e258d2fab8b40e1 /jsonschema/tests | |
parent | db1e18591333fa72c30fac3b7dfc7ef175612578 (diff) | |
download | jsonschema-4f0ef528d482968f3648ae8ad535b9dd62f655ad.tar.gz |
Enable ruff's simplify rules too.
Diffstat (limited to 'jsonschema/tests')
-rw-r--r-- | jsonschema/tests/_suite.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/jsonschema/tests/_suite.py b/jsonschema/tests/_suite.py index 6be05be..a79b1e2 100644 --- a/jsonschema/tests/_suite.py +++ b/jsonschema/tests/_suite.py @@ -4,6 +4,7 @@ Python representations of the JSON Schema Test Suite tests. from __future__ import annotations from collections.abc import Iterable, Mapping +from contextlib import suppress from functools import partial from pathlib import Path from typing import TYPE_CHECKING, Any @@ -131,13 +132,11 @@ class Version: } cls = type(name, (unittest.TestCase,), methods) - try: + # We're doing crazy things, so if they go wrong, like a function + # behaving differently on some other interpreter, just make them + # not happen. + with suppress(Exception): cls.__module__ = _someone_save_us_the_module_of_the_caller() - except Exception: # pragma: no cover - # We're doing crazy things, so if they go wrong, like a function - # behaving differently on some other interpreter, just make them - # not happen. - pass return cls @@ -255,10 +254,8 @@ class _Test: validator.validate(instance=self.data) def validate_ignoring_errors(self, Validator): # pragma: no cover - try: + with suppress(jsonschema.ValidationError): self.validate(Validator=Validator) - except jsonschema.ValidationError: - pass def _someone_save_us_the_module_of_the_caller(): |