import unittest
def add_numbers(a, b):
return a + b
class TestAddNumbers(unittest.TestCase):
def test_00_add_numbers(self):
result = add_numbers(3, 5)
self.assertEqual(result, 8)
def test_01_add_with_zero(self):
result = add_numbers(-1, 0)
self.assertEqual(result, -1)
def test_02_add_negative_numbers(self):
assert add_numbers(-2, -1) == -3
assert add_numbers(-3, -7) == -10
if __name__ == '__main__':
unittest.main()
# This is a command line entry point. It means that if you execute the script
# alone by running python test.py at the command line, it will call unittest.main().
# This executes the test runner by discovering all classes in this file that
# inherit from unittest.TestCase.