File tree Expand file tree Collapse file tree 3 files changed +9
-24
lines changed
Expand file tree Collapse file tree 3 files changed +9
-24
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -134,13 +134,6 @@ def isiterable(obj: Any) -> bool:
134134 return not istext (obj )
135135 except TypeError :
136136 return False
137- except Exception as e :
138- raise ValueError (
139- [
140- f"pytest_assertion plugin: unexpected exception { e !r} while testing object { obj !r} " ,
141- ", probably from __iter__" ,
142- ]
143- )
144137
145138
146139def has_default_eq (
@@ -202,20 +195,13 @@ def assertrepr_compare(
202195 explanation = _notin_text (left , right , verbose )
203196 except outcomes .Exit :
204197 raise
205- except Exception as e :
206- if (
207- isinstance (e , ValueError )
208- and (len (e .args ) == 1 )
209- and ("__iter__" in str (e .args [0 ]))
210- ):
211- explanation = e .args [0 ]
212- else :
213- explanation = [
214- "(pytest_assertion plugin: representation of details failed: {}." .format (
215- _pytest ._code .ExceptionInfo .from_current ()._getreprcrash ()
216- ),
217- " Probably an object has a faulty __repr__.)" ,
218- ]
198+ except Exception :
199+ explanation = [
200+ "(pytest_assertion plugin: representation of details failed: {}." .format (
201+ _pytest ._code .ExceptionInfo .from_current ()._getreprcrash ()
202+ ),
203+ " Probably an object has a faulty __repr__.)" ,
204+ ]
219205
220206 if not explanation :
221207 return None
Original file line number Diff line number Diff line change @@ -689,7 +689,7 @@ def test_assert_handling_raise_in__iter__(self) -> None:
689689 def f () -> None :
690690 class A :
691691 def __iter__ (self ):
692- raise ValueError ( )
692+ raise TypeError ( "user message" )
693693
694694 def __eq__ (self , o : object ) -> bool :
695695 return self is o
@@ -698,7 +698,7 @@ def __eq__(self, o: object) -> bool:
698698
699699 msg = getmsg (f )
700700 assert msg is not None
701- assert "__iter__" in msg and "__repr__" not in msg
701+ assert "Unexpected exception" in msg
702702
703703 def test_formatchar (self ) -> None :
704704 def f () -> None :
You can’t perform that action at this time.
0 commit comments