def media_post(
    numeros
) -> Union[CalcularMediaResponse200, Tuple[Error, int]]:  # noqa: E501
    """Devuelve la media de los números introducidos

     # noqa: E501

    :param numeros: La media de los números a devolver
    :type numeros: dict | bytes

    :rtype: CalcularMediaResponse200
    """
    try:
        if connexion.request.is_json:
            numeros = CalcularMediaPost.from_dict(
                connexion.request.get_json())  # noqa: E501
            return media(numeros)
        else:
            return Error("No es un JSON válido"), 400
    except:
        return Error("Error desconocido"), 500
 def test_ok_false(self):
     c = media(CalcularMediaPost([1, 4.34, 9], False))
     expected_media = 4.78
     self.assertEqual(c.media, expected_media)
 def test_list_string_none(self):
     c = media(CalcularMediaPost([1, "asdasd", None, 5]))
     expected_error = Error('El array de números contiene tipos no válidos')
     expected_code = 400
     self.assertEqual(c[0], expected_error)
     self.assertEqual(c[1], expected_code)
 def test_list_empty(self):
     c = media(CalcularMediaPost([]))
     expected_error = Error("El array está vacío")
     expected_code = 400
     self.assertEqual(c[0], expected_error)
     self.assertEqual(c[1], expected_code)
 def test_none(self):
     c = media(CalcularMediaPost(None))
     expected_error = Error('El array está vacío')
     expected_code = 400
     self.assertEqual(c[0], expected_error)
     self.assertEqual(c[1], expected_code)
 def test_ok_no_bool(self):
     c = media(CalcularMediaPost([1, 4.34, 9]))
     expected_media = 4.78
     self.assertEqual(c.media, expected_media)
 def test_ok_true(self):
     c = media(CalcularMediaPost([1, 4.34, 9], True))
     expected_media = 4
     self.assertEqual(c.media, expected_media)