Spaces:
Runtime error
Runtime error
File size: 2,419 Bytes
2d144e4 |
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
import pytest
import re
from chatgpt4uavs import get_command
# format: command: <command> \t<goal>
def parse_command(text):
tokens = re.split(' \t|\n|: ', text.lower())
print(tokens)
assert tokens[1] == 'command'
return tokens[2]
def test_red_house():
text = "Go to the red house on W Broad St."
output = get_command(text)
command = parse_command(output)
assert command == "go to"
def test_take_off():
text = "Take off from where you are."
output = get_command(text)
command = parse_command(output)
assert command == "take off"
def test_land():
text = "Land now."
output = get_command(text)
command = parse_command(output)
assert command == "land"
def test_picture():
text = "Take a picture."
output = get_command(text)
command = parse_command(output)
assert command == "take picture"
def test_snap_pic():
text = "Snap a photo."
output = get_command(text)
command = parse_command(output)
assert command == "take picture"
def test_purple_house():
text = "Travel to the purple house on the left side."
output = get_command(text)
command = parse_command(output)
assert command == "go to"
def test_parking_garage():
text = "Fly to the parking garage across the street."
output = get_command(text)
command = parse_command(output)
assert command == "go to"
def test_gym():
text = "Check out the Cary St Gym."
output = get_command(text)
command = parse_command(output)
assert command == "go to"
def test_cease_flight():
text = "Cease flight."
output = get_command(text)
command = parse_command(output)
assert command == "land"
def test_stop_flight():
text = "Stop the flight."
output = get_command(text)
command = parse_command(output)
assert command == "land"
def test_lift_off():
text = "Lift off."
output = get_command(text)
command = parse_command(output)
assert command == "take off"
def test_no_location1():
text = "Check out."
output = get_command(text)
command = parse_command(output)
assert command == "None"
def test_no_location2():
text = "Go to"
output = get_command(text)
command = parse_command(output)
assert command == "None"
def test_no_location3():
text = "Travel to"
output = get_command(text)
command = parse_command(output)
assert command == "None"
|