Skip to content

Commit 0e6886e

Browse files
committed
Add test for corner case
1 parent b940aab commit 0e6886e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/test_pointclouds.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,19 @@ def test_roundtrip(self):
7575
np.testing.assert_equal(points_arr, new_points_arr)
7676

7777
def test_roundtrip_numpy(self):
78-
7978
points_arr = self.makeArray(100)
8079
cloud_msg = rnp.msgify(PointCloud2, points_arr)
8180
new_points_arr = rnp.numpify(cloud_msg)
8281

8382
np.testing.assert_equal(points_arr, new_points_arr)
8483

84+
def test_roundtrip_zero_points(self):
85+
"""Test to make sure zero point arrays don't raise memoryview.cast(*) errors"""
86+
points_arr = self.makeArray(0)
87+
cloud_msg = rnp.msgify(PointCloud2, points_arr)
88+
new_points_arr = rnp.numpify(cloud_msg)
89+
90+
np.testing.assert_equal(points_arr, new_points_arr)
91+
8592
if __name__ == '__main__':
8693
unittest.main()

0 commit comments

Comments
 (0)