In [ ]:
""" Implement the absolute_value function """

import unittest


def absolute_value(n):
    """Create a function that returns the absolute value of a number.
    If the input was positive, add one to the result.
    If the number was negative, subtract one from the result.
    """
    return n # TODO remove this line, then implement your logic

# Tests below
# You can look, but don't touch!

class AbsoluteValueUnitTests(unittest.TestCase):
    """Test the absolute_value method"""

    def test_adds_one(self):
        self.assertEqual(5, absolute_value(4))

    def test_subtracts_one(self):
        self.assertEqual(22, absolute_value(-23))

    def test_handles_zero(self):
        self.assertEqual(0, absolute_value(0))

suite = unittest.TestLoader().loadTestsFromTestCase(AbsoluteValueUnitTests)
unittest.TextTestRunner().run(suite)

In [ ]: