def test_deveEmpacotarEDesempacotar(self): string, inteiro, flutuante = "Teste", 1, 1.2 p1 = PacoteInformacao(string) p2 = PacoteInformacao(inteiro) p3 = PacoteInformacao(flutuante) pg1 = PacoteInformacao(byteArray=p1.toByteArray()) pg2 = PacoteInformacao(byteArray=p2.toByteArray()) pg3 = PacoteInformacao(byteArray=p3.toByteArray()) self.assertEqual(pg1.getValor(), string) self.assertEqual(pg2.getValor(), inteiro) self.assertEqual(pg3.getValor(), flutuante)
def test_naoDeveAceitarDesempacotar(self): pacote = PacoteInformacao("qwe") with self.assertRaises(InformacaoException): InformacaoTipoValor(byteArray=pacote.toByteArray())