use unittest framework instead of pytest
parent
84d291003f
commit
bc68ecb5ab
|
@ -8,6 +8,8 @@ See LICENSE for the license information
|
||||||
Author: John Lambert (Python)
|
Author: John Lambert (Python)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gtsam
|
import gtsam
|
||||||
|
@ -19,16 +21,23 @@ def vector3(x: float, y: float, z: float) -> np.ndarray:
|
||||||
return np.array([x, y, z], dtype=float)
|
return np.array([x, y, z], dtype=float)
|
||||||
|
|
||||||
|
|
||||||
def test_lago() -> None:
|
class TestLago(unittest.TestCase):
|
||||||
"""Smokescreen to ensure LAGO can be imported and run on toy data stored in a g2o file."""
|
"""Test selected LAGO methods."""
|
||||||
g2oFile = gtsam.findExampleDataFile("noisyToyGraph.txt")
|
|
||||||
|
|
||||||
graph = gtsam.NonlinearFactorGraph()
|
def test_initialize(self) -> None:
|
||||||
graph, initial = gtsam.readG2o(g2oFile)
|
"""Smokescreen to ensure LAGO can be imported and run on toy data stored in a g2o file."""
|
||||||
|
g2oFile = gtsam.findExampleDataFile("noisyToyGraph.txt")
|
||||||
|
|
||||||
# Add prior on the pose having index (key) = 0
|
graph = gtsam.NonlinearFactorGraph()
|
||||||
priorModel = gtsam.noiseModel.Diagonal.Variances(vector3(1e-6, 1e-6, 1e-8))
|
graph, initial = gtsam.readG2o(g2oFile)
|
||||||
graph.add(PriorFactorPose2(0, Pose2(), priorModel))
|
|
||||||
|
|
||||||
estimateLago: Values = gtsam.lago.initialize(graph)
|
# Add prior on the pose having index (key) = 0
|
||||||
assert isinstance(estimateLago, Values)
|
priorModel = gtsam.noiseModel.Diagonal.Variances(vector3(1e-6, 1e-6, 1e-8))
|
||||||
|
graph.add(PriorFactorPose2(0, Pose2(), priorModel))
|
||||||
|
|
||||||
|
estimateLago: Values = gtsam.lago.initialize(graph)
|
||||||
|
assert isinstance(estimateLago, Values)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue