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
2 changes: 1 addition & 1 deletion PythonClient/airsim/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class ImageResponse(MsgpackMixin):
camera_orientation = Quaternionr()
time_stamp = np.uint64(0)
message = ''
pixels_as_float = 0.0
pixels_as_float = False
compress = True
width = 0
height = 0
Expand Down
Empty file added PythonClient/tests/__init__.py
Empty file.
34 changes: 34 additions & 0 deletions PythonClient/tests/test_image_response_pixels_as_float.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Offline check: ImageResponse.pixels_as_float is a bool (matches C++ RPC)."""
from __future__ import annotations

import importlib.util
import sys
import types
import unittest
from pathlib import Path


def _load_types():
if "msgpackrpc" not in sys.modules:
sys.modules["msgpackrpc"] = types.ModuleType("msgpackrpc")
root = Path(__file__).resolve().parents[1] / "airsim" / "types.py"
spec = importlib.util.spec_from_file_location("airsim_types_under_test", root)
mod = importlib.util.module_from_spec(spec)
assert spec.loader is not None
spec.loader.exec_module(mod)
return mod


class TestImageResponsePixelsAsFloat(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.types = _load_types()

def test_pixels_as_float_is_bool_false(self):
r = self.types.ImageResponse()
self.assertIsInstance(r.pixels_as_float, bool)
self.assertIs(r.pixels_as_float, False)


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