def test_raise_from_different(self): try: raise ValueError() except Exception as exc: try: raise_from(KeyError(), TypeError()) except Exception: self.check_capture(['TypeError', 'KeyError'])
def test_raise_from(self): try: raise ValueError() except Exception as exc: try: raise_from(KeyError(), exc) except Exception: self.check_capture(['ValueError', 'KeyError'])
def test_handles_self_referencing(self): try: raise ValueError() except Exception as exc: try: raise_from(exc, exc) except Exception: self.check_capture(['ValueError']) else: pytest.fail() else: pytest.fail() try: raise ValueError() except Exception as exc: try: raise_from(KeyError(), exc) except KeyError as exc2: try: raise_from(exc, exc2) except Exception: self.check_capture(['KeyError', 'ValueError']) else: pytest.fail() else: pytest.fail()