def test_heron_perfect_root(self): expected = 10.0 actual = exceptions.heron(100) self.assertEqual(actual, expected)
def test_heron_error_print_value(self, mock_stdout): exceptions.heron(-1) expected = "Error: The number provided must be positive!\n" self.assertEqual(expected, mock_stdout.getvalue())
def test_heron_error_zero(self): actual = exceptions.heron(-1) expected = -1 self.assertEqual(actual, expected)
def test_heron_float(self): expected = math.sqrt(5.5) actual = exceptions.heron(5.5) self.assertAlmostEqual(actual, expected)
def test_heron_non_perfect_int(self): expected = math.sqrt(42) actual = exceptions.heron(42) self.assertAlmostEqual(actual, expected)
def test_heron_negative_number(self): """Test function with a negative number""" argument = -100 expected = -1 actual = heron(argument) self.assertEqual(expected, actual)
def test_heron_zero(self): """Test function with 0""" argument = 0 expected = 0 actual = heron(argument) self.assertEqual(expected, actual)
def test_heron_positive_number(self): """Test function with a positive number""" argument = 4 expected = 2.0 actual = heron(argument) self.assertEqual(expected, actual)
def test_heron_negative_one(self): """Test function with -1""" argument = -1 expected = -1 actual = heron(argument) self.assertEqual(expected, actual)
def test_heron_negative(self): actual = exceptions.heron(-21) expected = -1 self.assertEqual(actual, expected)
def test_heron_1(self): """Test function with 1""" argument = 1 expected = 1.0 actual = heron(argument) self.assertEqual(expected, actual)
def test_heron_root_is_float(self): actual = exceptions.heron(1000) expected = 31.62 self.assertEqual(actual, expected)
def test_heron_root_is_integer(self): actual = exceptions.heron(100) expected = 10.0 self.assertEqual(actual, expected)
def test_heron_one(self): actual = exceptions.heron(1) expected = 1.0 self.assertEqual(actual, expected)
def test_heron_between_zero_and_one(self): actual = exceptions.heron(0.25) expected = 0.5 self.assertEqual(actual, expected)
def test_heron_zero(self): actual = exceptions.heron(0) expected = 0.0 self.assertEqual(actual, expected)