Esempio n. 1
0
def get_chord(event):
    chord = extract_chord(event.message.text)
    if not chord:
        return {}
    audio = translate_chord(chord)
    audio.update({'file_name': '{}.wav'.format(chord)})
    response = save_file(audio)
    if not response:
        return {}
    return {'url': response['url'], 'duration': audio['duration']}
Esempio n. 2
0
def test_no_input():
    assert extract_chord('') == ''
Esempio n. 3
0
def test_lack_of_line_feed():
    assert extract_chord('演奏してC') == 'C'
Esempio n. 4
0
def test_major_seventh():
    assert extract_chord('演奏して\nCM7') == 'CM7'
    
Esempio n. 5
0
def test_single_major_chord():
    assert extract_chord("演奏して\nC") == 'C'
Esempio n. 6
0
def test_ending_with_number():
    assert extract_chord('演奏して\nCadd9') == 'Cadd9'
Esempio n. 7
0
def test_plural_chord():
    assert extract_chord('演奏して\nF7G7Em7Am') == 'F7'
Esempio n. 8
0
def test_no_chord():
    assert extract_chord('foobar') == ''