def dec_hex_ch(dec): if not dec: return ('ERROR - No ingreso nada') elif dec.isdecimal() == False: return ('ERROR - Debe ingresar solo numeros') else: resp = decimal_to_hexa(int(dec)) return (f'El numero {dec} es {resp} en hexadecimal.')
def check(num): if not num: return 'ERROR -- Ingreso vacio' if num.isdigit() == False : return 'ERROR -- No puede ingresar palabras' else: resp = decimal_to_hexa(int(num)) return resp
def test_10_to_hex_A(self): hexa_num = decimal_to_hexa(10) self.assertEqual(hexa_num, 'A')
def test_5_to_hex_5(self): hexa_num = decimal_to_hexa(5) self.assertEqual(hexa_num, '5')
def test_921_to_hex_(self): hexa_num = decimal_to_hexa(921) self.assertEqual(hexa_num, '399')
def test_234_to_hex_EA(self): hexa_num = decimal_to_hexa(234) self.assertEqual(hexa_num, 'EA')
def test_1234_to_hex_4D2(self): hexa_num = decimal_to_hexa(1234) self.assertEqual(hexa_num, '4D2')
def test_4095_to_hex_FFF(self): hexa_num = decimal_to_hexa(4095) self.assertEqual(hexa_num, 'FFF')
def test_16_to_hex_10(self): hexa_num = decimal_to_hexa(16) self.assertEqual(hexa_num, '10')
def test_17_to_hex_11(self): hexa_num = decimal_to_hexa(17) self.assertEqual(hexa_num, '11')