Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PythonClient/airsim/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def __init__(self, camera_name, image_type, pixels_as_float = False, compress =


class ImageResponse(MsgpackMixin):
image_data_uint8 = np.uint8(0)
image_data_float = 0.0
image_data_uint8 = b""
image_data_float = []
camera_position = Vector3r()
camera_orientation = Quaternionr()
time_stamp = np.uint64(0)
Expand Down
1 change: 1 addition & 0 deletions PythonClient/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

21 changes: 21 additions & 0 deletions PythonClient/tests/test_image_response_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import unittest

from airsim.types import ImageResponse


class TestImageResponseDefaults(unittest.TestCase):
def test_default_buffers_are_empty_iterables(self):
r = ImageResponse()
self.assertIsInstance(r.image_data_uint8, (bytes, bytearray))
self.assertEqual(len(r.image_data_uint8), 0)
self.assertIsInstance(r.image_data_float, list)
self.assertEqual(len(r.image_data_float), 0)
# Sample code paths
self.assertEqual(len(r.image_data_uint8), 0)
import numpy as np
arr = np.frombuffer(r.image_data_uint8, dtype=np.uint8)
self.assertEqual(arr.size, 0)


if __name__ == "__main__":
unittest.main()