Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created December 5, 2019 01:43
Show Gist options
  • Save FerdinaKusumah/45c142951375026fb9ca6a2c325e6d31 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/45c142951375026fb9ca6a2c325e6d31 to your computer and use it in GitHub Desktop.
Simple unit test 2
import unittest
import sum
class ExampleTestUnit(unittest.TestCase):
def test_sum(self):
self.assertEqual(sum.sum_values([1, 2, 3]), 6, "Hasilnya adalah 6")
def test_error(self):
with self.assertRaises(TypeError):
sum.sum_values([1, "2", "3"])
if __name__ == "__main__":
suite = unittest.TestLoader().loadTestsFromTestCase(ExampleTestUnit)
unittest.TextTestRunner(verbosity=2).run(suite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment