def test_with_element_exception(self): wrapped = _with_element(FakeDeltaGenerator.fake_text_raise_exception) dg = FakeDeltaGenerator() data = 'some_text' wrapped(dg, data) self.assertEqual(dg._exception_msg, 'Exception in fake_text_raise_exception')
def test_with_element(self): wrapped = _with_element(FakeDeltaGenerator.fake_text) dg = FakeDeltaGenerator() data = 'some_text' # This would really look like st.text(data) but since we're # testng the wrapper, it looks like this. element = wrapped(dg, data) self.assertEqual(element.new_element.text.body, data)
def test_with_element_exception(self): wrapped = _with_element(FakeDeltaGenerator.fake_text_raise_exception) dg = FakeDeltaGenerator() data = "some_text" with self.assertRaises(Exception) as ctx: wrapped(dg, data) self.assertTrue("Exception in fake_text_raise_exception" in str(ctx.exception))