simplify code / take out user-gen typeerror case
This commit is contained in:
parent
e938580257
commit
b9cb87d862
|
@ -132,13 +132,9 @@ def isiterable(obj: Any) -> bool:
|
|||
try:
|
||||
iter(obj)
|
||||
return not istext(obj)
|
||||
except TypeError:
|
||||
return False
|
||||
except Exception as e:
|
||||
if (
|
||||
isinstance(e, TypeError)
|
||||
and (len(e.args) == 1)
|
||||
and "iter() returned non-iterator of type" in str(e.args[0])
|
||||
):
|
||||
return False
|
||||
raise ValueError(f"Unexpected exception {e!r} while testing object {obj!r}")
|
||||
|
||||
|
||||
|
|
|
@ -689,7 +689,7 @@ class TestAssertionRewrite:
|
|||
def f() -> None:
|
||||
class A:
|
||||
def __iter__(self):
|
||||
raise TypeError("user message")
|
||||
raise ValueError()
|
||||
|
||||
def __eq__(self, o: object) -> bool:
|
||||
return self is o
|
||||
|
|
Loading…
Reference in New Issue