def which_translation(argument): if argument == 'M': return morse_to_text(message) elif argument == 'T': return text_to_morse(message) else: pass
def test_atext(): assert morseovka.text_to_morse("A") == ".-///"
def test_cisla_a_dalsi(): assert morseovka.text_to_morse("42!") == ("....-/..---/--..--///")
def test_na_vice_radku(): assert morseovka.text_to_morse("Ahoj\nheslo je KORÝŠ\n") == ".-/..../---/.---//\n...././.../.-../---//.---/.//-.-/---/.-./-.--/...///"
def test_spatneho_znaku(): with pytest.raises(KeyError): morseovka.text_to_morse("螭")
def test_smichu(): assert morseovka.text_to_morse("cha cha cha") == "----/.-//----/.-//----/.-///"
def test_veta_slovak(): assert morseovka.text_to_morse("Ľubozvučné slovenské slová sú guľôčka, stĺp, pŕŕ!") == ".-../..-/-.../---/--../...-/..-/-.-./-././/.../.-../---/...-/./-./.../-.-/.//.../.-../---/...-/.-//.../..-//--./..-/.-../---/-.-./-.-/.-/--..--//.../-/.-../.--./--..--//.--./.-./.-./--...-///"
def test_veta(): assert morseovka.text_to_morse("Tohle je věta") == "-/---/..../.-.././/.---/.//...-/./-/.-///"