File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,10 @@ def __delitem__(self, uri):
2828 def __iter__ (self ):
2929 return iter (self .store )
3030
31- def __len__ (self ):
31+ def __len__ (self ): # pragma: no cover -- untested, but to be removed
3232 return len (self .store )
3333
34- def __repr__ (self ):
34+ def __repr__ (self ): # pragma: no cover -- untested, but to be removed
3535 return repr (self .store )
3636
3737
Original file line number Diff line number Diff line change @@ -209,14 +209,14 @@ class _RefResolutionError(Exception):
209209
210210 def __eq__ (self , other ):
211211 if self .__class__ is not other .__class__ :
212- return NotImplemented
212+ return NotImplemented # pragma: no cover -- uncovered but deprecated # noqa: E501
213213 return self ._cause == other ._cause
214214
215215 def __str__ (self ):
216216 return str (self ._cause )
217217
218218
219- class _WrappedReferencingError (_RefResolutionError , _Unresolvable ):
219+ class _WrappedReferencingError (_RefResolutionError , _Unresolvable ): # pragma: no cover -- partially uncovered but to be removed # noqa: E501
220220 def __init__ (self , cause : _Unresolvable ):
221221 object .__setattr__ (self , "_wrapped" , cause )
222222
Original file line number Diff line number Diff line change @@ -396,6 +396,22 @@ def test_if_its_in_the_tree_anyhow_it_does_not_raise_an_error(self):
396396 tree = exceptions .ErrorTree ([error ])
397397 self .assertIsInstance (tree ["foo" ], exceptions .ErrorTree )
398398
399+ def test_iter (self ):
400+ e1 , e2 = (
401+ exceptions .ValidationError (
402+ "1" ,
403+ validator = "foo" ,
404+ path = ["bar" , "bar2" ],
405+ instance = "i1" ),
406+ exceptions .ValidationError (
407+ "2" ,
408+ validator = "quux" ,
409+ path = ["foobar" , 2 ],
410+ instance = "i2" ),
411+ )
412+ tree = exceptions .ErrorTree ([e1 , e2 ])
413+ self .assertEqual (set (tree ), {"bar" , "foobar" })
414+
399415 def test_repr_single (self ):
400416 error = exceptions .ValidationError (
401417 "1" ,
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ def test_it_catches_registered_errors(self):
5454
5555 self .assertIs (cm .exception .cause , BOOM )
5656 self .assertIs (cm .exception .__cause__ , BOOM )
57+ self .assertEqual (str (cm .exception ), "12 is not a 'boom'" )
5758
5859 # Unregistered errors should not be caught
5960 with self .assertRaises (type (BANG )):
You can’t perform that action at this time.
0 commit comments