Created
December 5, 2019 01:43
-
-
Save FerdinaKusumah/45c142951375026fb9ca6a2c325e6d31 to your computer and use it in GitHub Desktop.
Simple unit test 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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