Spaces:
Runtime error
Runtime error
File size: 1,938 Bytes
f750b58 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
import pytest
import re
from fewshot import FewShot4UAVs
@pytest.fixture
def fewshot():
return FewShot4UAVs()
# format: <command> \t<goal>
def parse_multiple_commands(text):
text = text.lstrip('\n')
lines = text.split("\n")
first_action = lines[0].split()[0].lower()
second_action = lines[1].split()[0].lower()
return first_action, second_action
def test_multiple_actions(fewshot):
text = "Take a photo and then take off."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('takephoto', 'takeoff')
def test_two_go_to(fewshot):
text = "Go to the Kroger on Lombardy St and then go to Roots on W Grace St."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('goto', 'goto')
def test_multiple_actions_and_locations(fewshot):
text = "Fly to the park and take a picture of the red house."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('goto', 'takephoto')
def test_action_and_location(fewshot):
text = "Fly to the park and take a picture."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('goto', 'takephoto')
def test_action_and_location_synonyms(fewshot):
text = "Hover and head to the closest park."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('takeoff', 'goto')
def test_action_synonyms(fewshot):
text = "Ascend and then take a photo."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('takeoff', 'takephoto')
def test_action_synonyms2(fewshot):
text = "Descend and then take a photo."
output = fewshot.get_command(text)
command = parse_multiple_commands(output)
assert command == ('land', 'takephoto') |