From 71acb723b3db79da646f9c82add2fb0e6ba1a271 Mon Sep 17 00:00:00 2001 From: Simon Brunning Date: Thu, 27 Feb 2020 13:32:38 +0000 Subject: [PATCH] Remove unnecessary casts. --- src/hamcrest/core/core/raises.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hamcrest/core/core/raises.py b/src/hamcrest/core/core/raises.py index 723f0d06..afb7fd9e 100644 --- a/src/hamcrest/core/core/raises.py +++ b/src/hamcrest/core/core/raises.py @@ -39,7 +39,7 @@ def _call_function(self, function: Callable[..., Any]) -> bool: except BaseException: self.actual = sys.exc_info()[1] - if isinstance(self.actual, cast(type, self.expected)): + if isinstance(self.actual, self.expected): if self.pattern is not None: if re.search(self.pattern, str(self.actual)) is None: return False @@ -65,7 +65,7 @@ def describe_mismatch(self, item, description: Description) -> None: if self.actual is None: description.append_text("No exception raised.") - elif isinstance(self.actual, cast(type, self.expected)): + elif isinstance(self.actual, self.expected): if self.pattern is not None or self.matcher is not None: description.append_text("Correct assertion type raised, but ") if self.pattern is not None: