Skip to content

Commit

Permalink
unit test 오류 수정1
Browse files Browse the repository at this point in the history
  • Loading branch information
boobooboo2 committed Dec 19, 2024
1 parent 8e939a7 commit 2109983
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion examples/basic_usage_examples/env_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

while True:
print(f"humidity(%): {env.humidity:<10} temperature(°C): {env.temperature:<10} "
f"intensity(%): {env.intensity:<10} Volume(%): {env.volume:<10}", end="\r")
f"illuminance(%): {env.illuminance:<10} Volume(%): {env.volume:<10}", end="\r")
time.sleep(0.02)
4 changes: 2 additions & 2 deletions modi_plus/module/input_module/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Env(InputModule):

PROPERTY_ENV_STATE = 2

PROPERTY_OFFSET_INTENSICY = 0
PROPERTY_OFFSET_ILLUMINANCE = 0
PROPERTY_OFFSET_TEMPERATURE = 2
PROPERTY_OFFSET_HUMIDITY = 4
PROPERTY_OFFSET_VOLUME = 6
Expand All @@ -21,7 +21,7 @@ def illuminance(self) -> int:
:rtype: int
"""

offset = Env.PROPERTY_OFFSET_INTENSICY
offset = Env.PROPERTY_OFFSET_ILLUMINANCE
raw = self._get_property(Env.PROPERTY_ENV_STATE)
data = struct.unpack("h", raw[offset:offset + 2])[0]
return data
Expand Down
2 changes: 1 addition & 1 deletion modi_plus/module/input_module/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def angle(self) -> Tuple[float, float, float]:
:rtype: tuple
"""

return self.angle_x, self.angle_y_y, self.angle_z
return self.angle_x, self.angle_y, self.angle_z

@property
def angular_vel_x(self) -> float:
Expand Down
6 changes: 3 additions & 3 deletions tests/module/input_module/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def test_get_humidity(self):
)
self.assertEqual(_, 0)

def test_get_intensity(self):
"""Test get_intensity method."""
def test_get_illuminance(self):
"""Test get_illuminance method."""

_ = self.env.intensity
_ = self.env.illuminance
self.assertEqual(
self.connection.send_list[0],
parse_get_property_message(-1, Env.PROPERTY_ENV_STATE, self.env.prop_samp_freq)
Expand Down
5 changes: 4 additions & 1 deletion tests/module/output_module/test_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def test_set_angle(self):
self.motor.angle = mock_angle, mock_speed
set_message = parse_set_property_message(
-1, Motor.PROPERTY_MOTOR_ANGLE,
(("u16", mock_angle), ("u16", mock_speed), )
(("u16", mock_angle),
("u16", mock_speed),
("u16", 0),
("u16", 0), )
)
sent_messages = []
while self.connection.send_list:
Expand Down
18 changes: 9 additions & 9 deletions tests/module/setup_module/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,30 @@ def test_time_up(self):
)
self.assertEqual(_, False)

def test_imu_angle_x(self):
"""Test imu_angle_x method."""
def test_imu_roll(self):
"""Test imu_roll method."""

_ = self.network.imu_angle_x
_ = self.network.imu_roll
self.assertEqual(
self.connection.send_list[0],
parse_get_property_message(-1, Network.PROPERTY_NETWORK_IMU, self.network.prop_samp_freq)
)
self.assertEqual(_, 0)

def test_imu_angle_y(self):
"""Test imu_angle_y method."""
def test_imu_pitch(self):
"""Test imu_pitch method."""

_ = self.network.imu_angle_y
_ = self.network.imu_pitch
self.assertEqual(
self.connection.send_list[0],
parse_get_property_message(-1, Network.PROPERTY_NETWORK_IMU, self.network.prop_samp_freq)
)
self.assertEqual(_, 0)

def test_imu_angle_z(self):
"""Test imu_angle_z method."""
def test_imu_yaw(self):
"""Test imu_yaw method."""

_ = self.network.imu_angle_z
_ = self.network.imu_yaw
self.assertEqual(
self.connection.send_list[0],
parse_get_property_message(-1, Network.PROPERTY_NETWORK_IMU, self.network.prop_samp_freq)
Expand Down

0 comments on commit 2109983

Please sign in to comment.