def test_sum(self): """This is an actual test """ expected = 9 # unittest.TestCase provides several assertion methods self.assertEqual(expected, lib_to_test.sum(self.x, self.y), "Sum results differ") self.assertTrue(expected == lib_to_test.sum(self.x, self.y)) # Message is optional self.assertGreaterEqual(lib_to_test.sum(self.x, self.y), self.x) self.assertFalse(lib_to_test.sum(0, 0)) self.assertIsNotNone(lib_to_test.sum(0, 0))
def test_which_crashes(self): """This test will crash """ self.assertTrue(lib_to_test.sum())