Skip to content

Commit 03bb7a8

Browse files
fixed spelling of receive and received through a global search of the backend. (#853)
* fixed spelling of receive and received through a global search of the entire backend * linters + fix spelling of "successfully" * fix: accidentally switched received to receive
1 parent 59e55af commit 03bb7a8

7 files changed

Lines changed: 56 additions & 47 deletions

File tree

radio/app/controllers/flightModesController.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def setCurrentFlightMode(self, flightMode: int) -> Response:
137137
Args:
138138
flightmode (int): The numeric value for the current flight mode setting
139139
Returns:
140-
A message to show if the drone recieved the message and succesfully set the new mode
140+
A message to show if the drone received the message and successfully set the new mode
141141
"""
142142
if not self.drone.reserve_message_type("COMMAND_ACK", self.controller_id):
143143
return {
@@ -185,7 +185,7 @@ def setGuidedMode(self) -> Response:
185185
"""
186186
Set the drone's flight mode to Guided mode.
187187
Returns:
188-
A message to show if the drone recieved the message and succesfully set the new mode
188+
A message to show if the drone received the message and successfully set the new mode
189189
"""
190190

191191
mode = mavutil.mavlink.COPTER_MODE_GUIDED

radio/tests/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __exit__(self, type, value, traceback) -> None:
102102
droneStatus.drone.aircraft_type = self.old_aircraftType
103103

104104

105-
def send_and_recieve(endpoint: str, args: Optional[Union[dict, str]] = None) -> dict:
105+
def send_and_receive(endpoint: str, args: Optional[Union[dict, str]] = None) -> dict:
106106
"""Sends a request to the socketio test client and returns the response
107107
108108
Parameters
@@ -115,7 +115,7 @@ def send_and_recieve(endpoint: str, args: Optional[Union[dict, str]] = None) ->
115115
Returns
116116
-------
117117
dict
118-
The data recieved from the client
118+
The data received from the client
119119
"""
120120
(
121121
socketio_client.emit(endpoint, args)

radio/tests/test_comPorts.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from . import socketio_client
99
from .conftest import setupDrone
10-
from .helpers import send_and_recieve
10+
from .helpers import send_and_receive
1111

1212
VALID_DRONE_PORT: str
1313

@@ -45,7 +45,7 @@ def get_comport_name(port):
4545
def test_getComPort() -> None:
4646
# TODO: we should automate different OS environments for our unit tests maybe?
4747
assert (
48-
send_and_recieve("get_com_ports")
48+
send_and_receive("get_com_ports")
4949
== [
5050
f"{get_comport_name(port)}: {port.description}"
5151
for port in list_ports.comports()
@@ -56,28 +56,28 @@ def test_getComPort() -> None:
5656

5757
def test_connectToDrone_badType() -> None:
5858
# Failure on bad connection type
59-
assert send_and_recieve("connect_to_drone", {}) == {
59+
assert send_and_receive("connect_to_drone", {}) == {
6060
"message": "Connection type not specified."
6161
}
62-
assert send_and_recieve("connect_to_drone", {"connectionType": "testtype"}) == {
62+
assert send_and_receive("connect_to_drone", {"connectionType": "testtype"}) == {
6363
"message": "Connection type not specified."
6464
}
6565

6666

6767
def test_connectToDrone_badPort() -> None:
6868
# Failure on no port specified
69-
assert send_and_recieve("connect_to_drone", {"connectionType": "serial"}) == {
69+
assert send_and_receive("connect_to_drone", {"connectionType": "serial"}) == {
7070
"message": "COM port not specified."
7171
}
72-
assert send_and_recieve("connect_to_drone", {"connectionType": "network"}) == {
72+
assert send_and_receive("connect_to_drone", {"connectionType": "network"}) == {
7373
"message": "Connection address not specified."
7474
}
7575

7676
# Failure on bad port specified
77-
assert send_and_recieve(
77+
assert send_and_receive(
7878
"connect_to_drone", {"connectionType": "serial", "port": "testport"}
7979
) == {"message": "COM port not found."}
80-
assert send_and_recieve(
80+
assert send_and_receive(
8181
"connect_to_drone", {"connectionType": "serial", "port": "COM10:5761"}
8282
) == {"message": "COM port not found."}
8383

@@ -139,25 +139,25 @@ def test_connectToDrone_badBaud() -> None:
139139
)
140140

141141
# Failure on invalid baud rate value
142-
assert send_and_recieve(
142+
assert send_and_receive(
143143
"connect_to_drone",
144144
{"connectionType": connectionType, "port": VALID_DRONE_PORT, "baud": -1},
145145
) == {
146146
"message": f"{-1} is an invalid baudrate. Valid baud rates are {Drone.getValidBaudrates()}"
147147
}
148-
assert send_and_recieve(
148+
assert send_and_receive(
149149
"connect_to_drone",
150150
{"connectionType": connectionType, "port": VALID_DRONE_PORT, "baud": 110},
151151
) == {
152152
"message": f"{110} is an invalid baudrate. Valid baud rates are {Drone.getValidBaudrates()}"
153153
}
154154

155155
# Failure on invalid baud rate types
156-
assert send_and_recieve(
156+
assert send_and_receive(
157157
"connect_to_drone",
158158
{"connectionType": connectionType, "port": VALID_DRONE_PORT, "baud": 9600.0},
159159
) == {"message": "Expected integer value for baud, received float."}
160-
assert send_and_recieve(
160+
assert send_and_receive(
161161
"connect_to_drone",
162162
{"connectionType": connectionType, "port": VALID_DRONE_PORT, "baud": "9600"},
163163
) == {"message": "Expected integer value for baud, received str."}

radio/tests/test_gripper.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pymavlink import mavutil
66

77
from . import falcon_test
8-
from .helpers import FakeTCP, NoDrone, send_and_recieve
8+
from .helpers import FakeTCP, NoDrone, send_and_receive
99

1010

1111
@pytest.fixture(scope="module", autouse=True)
@@ -32,56 +32,56 @@ def run_once_after_all_tests():
3232
def test_gripperEnabled(socketio_client: SocketIOTestClient, droneStatus):
3333
# Failure on wrong drone state
3434
droneStatus.state = "params"
35-
assert send_and_recieve("get_gripper_enabled") == {
35+
assert send_and_receive("get_gripper_enabled") == {
3636
"message": "You must be on the config screen to access the gripper."
3737
}
3838

3939
# Failure with no drone connected
4040
droneStatus.state = "config"
4141
with NoDrone():
42-
assert send_and_recieve("get_gripper_enabled") == {
42+
assert send_and_receive("get_gripper_enabled") == {
4343
"message": "You must be connected to the drone to access the gripper."
4444
}
4545

4646
# Correct result on config page
47-
assert send_and_recieve("get_gripper_enabled") is True
47+
assert send_and_receive("get_gripper_enabled") is True
4848

4949

5050
@falcon_test(pass_drone_status=True)
5151
def test_setGripper(socketio_client: SocketIOTestClient, droneStatus):
5252
# Failure on wrong drone state
5353
droneStatus.state = "params"
54-
assert send_and_recieve("set_gripper", "release") == {
54+
assert send_and_receive("set_gripper", "release") == {
5555
"message": "You must be on the config screen to access the gripper."
5656
}
5757

5858
# Failure with no drone connected
5959
droneStatus.state = "config"
6060
with NoDrone():
61-
assert send_and_recieve("set_gripper", "release") == {
61+
assert send_and_receive("set_gripper", "release") == {
6262
"message": "You must be connected to the drone to access the gripper."
6363
}
6464

6565
# Failure on incorrect gripper value
66-
assert send_and_recieve("set_gripper", "testgrippervalue") == {
66+
assert send_and_receive("set_gripper", "testgrippervalue") == {
6767
"message": 'Gripper action must be either "release" or "grab"'
6868
}
6969

7070
# Success on release
71-
assert send_and_recieve("set_gripper", "release") == {
71+
assert send_and_receive("set_gripper", "release") == {
7272
"success": True,
7373
"message": "Setting gripper to release",
7474
}
7575

7676
# Success on grab
77-
assert send_and_recieve("set_gripper", "grab") == {
77+
assert send_and_receive("set_gripper", "grab") == {
7878
"success": True,
7979
"message": "Setting gripper to grab",
8080
}
8181

8282
# Serial exception handled correctly
8383
with FakeTCP():
84-
assert send_and_recieve("set_gripper", "grab") == {
84+
assert send_and_receive("set_gripper", "grab") == {
8585
"success": False,
8686
"message": "Setting gripper failed, serial exception",
8787
}
@@ -95,8 +95,8 @@ def test_gripperDisabled(socketio_client: SocketIOTestClient, droneStatus) -> No
9595
# Allow time for gripper to be updated
9696
time.sleep(0.5)
9797

98-
assert send_and_recieve("get_gripper_enabled") is False
99-
assert send_and_recieve("set_gripper", "release") == {
98+
assert send_and_receive("get_gripper_enabled") is False
99+
assert send_and_receive("set_gripper", "release") == {
100100
"success": False,
101101
"message": "Gripper is not enabled",
102102
}

radio/tests/test_mission.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,13 @@ def test_exportMissionToFile_missionExportSuccess(
548548
"message": f"Waypoint file saved 8 points successfully to {export_file_path}",
549549
}
550550
assert os.path.exists(export_file_path)
551-
with open(export_file_path, "r") as f, open(
552-
os.path.join(MISSION_FILES_PATH, "exported_mission_check.txt"),
553-
"r",
554-
) as f_expected:
551+
with (
552+
open(export_file_path, "r") as f,
553+
open(
554+
os.path.join(MISSION_FILES_PATH, "exported_mission_check.txt"),
555+
"r",
556+
) as f_expected,
557+
):
555558
assert f.read() == f_expected.read()
556559

557560

@@ -581,10 +584,13 @@ def test_exportMissionToFile_fenceExportSuccess(
581584
"message": f"Waypoint file saved 13 points successfully to {export_file_path}",
582585
}
583586
assert os.path.exists(export_file_path)
584-
with open(export_file_path, "r") as f, open(
585-
os.path.join(MISSION_FILES_PATH, "exported_fence_check.txt"),
586-
"r",
587-
) as f_expected:
587+
with (
588+
open(export_file_path, "r") as f,
589+
open(
590+
os.path.join(MISSION_FILES_PATH, "exported_fence_check.txt"),
591+
"r",
592+
) as f_expected,
593+
):
588594
assert f.read() == f_expected.read()
589595

590596

@@ -614,10 +620,13 @@ def test_exportMissionToFile_rallyExportSuccess(
614620
"message": f"Waypoint file saved 2 points successfully to {export_file_path}",
615621
}
616622
assert os.path.exists(export_file_path)
617-
with open(export_file_path, "r") as f, open(
618-
os.path.join(MISSION_FILES_PATH, "exported_rally_check.txt"),
619-
"r",
620-
) as f_expected:
623+
with (
624+
open(export_file_path, "r") as f,
625+
open(
626+
os.path.join(MISSION_FILES_PATH, "exported_rally_check.txt"),
627+
"r",
628+
) as f_expected,
629+
):
621630
assert f.read() == f_expected.read()
622631

623632

radio/tests/test_motors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def assert_motorResult(
1313
err: Optional[str] = None,
1414
) -> None:
1515
"""
16-
Takes the data recieved from the socketio test client and asserts that it matches the given
16+
Takes the data received from the socketio test client and asserts that it matches the given
1717
expected values
1818
1919
Args:
20-
data (dict): The data recieved using `client.get_recieved()`
20+
data (dict): The data received using `client.get_received()`
2121
success (bool): Whether the request should have been successful or not
2222
motor (str, optional): Which motor the request should have tested, default `None`
2323
err (str, optional): What the error message should have been, default `None`
@@ -42,7 +42,7 @@ def send_testOneMotor(
4242
duration (int): The duration of the test
4343
4444
Returns:
45-
dict: The data recieved from the client using `.get_recieved()`
45+
dict: The data received from the client using `.get_received()`
4646
"""
4747
client.emit(
4848
"test_one_motor",
@@ -66,7 +66,7 @@ def send_testMotors(
6666
duration (int): The duration of the test
6767
6868
Returns:
69-
dict: The data recieved from the client using `.get_recieved()`
69+
dict: The data received from the client using `.get_received()`
7070
"""
7171
client.emit(
7272
"test_all_motors" if test_all else "test_motor_sequence",

radio/tests/test_states.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from flask_socketio import SocketIOTestClient
22

33
from . import falcon_test
4-
from .helpers import NoDrone, send_and_recieve
4+
from .helpers import NoDrone, send_and_receive
55

66

77
@falcon_test(pass_drone_status=True)
88
def test_setState(socketio_client: SocketIOTestClient, droneStatus) -> None:
99
# Failure on no drone connection
1010
with NoDrone():
11-
assert send_and_recieve("set_state", "dashboard") == {
11+
assert send_and_receive("set_state", "dashboard") == {
1212
"message": "Must be connected to the drone to set the drone state."
1313
}
1414

1515
# Failure on no state sent
16-
assert send_and_recieve("set_state", {}) == {
16+
assert send_and_receive("set_state", {}) == {
1717
"message": "Request to endpoint set_state missing value for parameter: state."
1818
}
1919

0 commit comments

Comments
 (0)