def on_message(self, msg): try: if msg['text'][0] == "/": taxa = msg['text'][1:].lower() Fabrica.destroy() fabrica = Fabrica(taxa=taxa) self.sender.sendMessage(fabrica.get()) except Exception as e: logr.error(e, exc_info=True)
def test_carrega_dolar(): Fabrica.destroy() fabrica = Fabrica(taxa="dolar") assert isinstance(fabrica, Dolar)
def test_erro_taxa_merda(): Fabrica.destroy() with pytest.raises(Exception): (Fabrica(taxa="merda"))