Skip to content

Commit 59856b6

Browse files
committed
Fix python unit tests
1 parent a9d6bfb commit 59856b6

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

python/gtsam/tests/test_Pose3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def test_adjoint(self):
157157
actual = Pose3.adjoint_(xi, xi)
158158
np.testing.assert_array_equal(actual, expected)
159159

160+
@unittest.skipUnless(hasattr(gtsam.Pose3, "serialize"), "Serialization not enabled")
160161
def test_serialization(self):
161162
"""Test if serialization is working normally"""
162163
expected = Pose3(Rot3.Ypr(0.0, 1.0, 0.0), Point3(1, 1, 0))

python/gtsam/tests/test_Serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
import unittest
1313

1414
import numpy as np
15-
from gtsam.symbol_shorthand import B, V, X
1615
from gtsam.utils.test_case import GtsamTestCase
1716

1817
import gtsam
1918

2019

20+
@unittest.skipUnless(hasattr(gtsam.Pose3, "serialize"), "Serialization not enabled")
2121
class TestDeepCopy(GtsamTestCase):
2222
"""Tests for deep copy of various GTSAM objects."""
2323

python/gtsam/tests/test_pickle.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@
99
1010
Author: Ayush Baid
1111
"""
12+
13+
import unittest
1214
from gtsam.utils.test_case import GtsamTestCase
1315

14-
from gtsam import (Cal3Bundler, PinholeCameraCal3Bundler, Point2, Point3,
15-
Pose3, Rot3, SfmTrack, Unit3)
16+
from gtsam import (
17+
Cal3Bundler,
18+
PinholeCameraCal3Bundler,
19+
Point2,
20+
Point3,
21+
Pose3,
22+
Rot3,
23+
SfmTrack,
24+
Unit3,
25+
)
1626

1727

28+
@unittest.skipUnless(hasattr(Pose3, "serialize"), "Serialization not enabled")
1829
class TestPickle(GtsamTestCase):
1930
"""Tests pickling on some of the classes."""
2031

@@ -46,3 +57,7 @@ def test_sfmTrack_roundtrip(self):
4657
def test_unit3_roundtrip(self):
4758
obj = Unit3(Point3(1, 1, 0))
4859
self.assertEqualityOnPickleRoundtrip(obj)
60+
61+
62+
if __name__ == "__main__":
63+
unittest.main()

0 commit comments

Comments
 (0)