Loading autocnet/graph/tests/test_edge.py +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import ogr from unittest.mock import Mock from unittest.mock import MagicMock from autocnet.examples import get_path from autocnet.graph.network import CandidateGraph from autocnet.fileio import io_gdal import pandas as pd Loading Loading @@ -75,6 +77,9 @@ class TestEdge(unittest.TestCase): self.assertAlmostEqual(e.weight['overlap_percn'], 14.285714285) def test_coverage(self): adjacency = get_path('two_image_adjacency.json') basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath=basepath) keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], Loading Loading @@ -121,4 +126,7 @@ class TestEdge(unittest.TestCase): e.destination.geodata.pixel_to_latlon = MagicMock(side_effect = pixel_to_latlon) e.matches = matches_df self.assertRaises(AttributeError, cg.edge[0][1].coverage) self.assertEqual(e.coverage(image='destination'), 0.3) self.assertEqual(e.coverage(image='source'), 0.3) autocnet/utils/tests/test_utils.py +13 −1 Original line number Diff line number Diff line Loading @@ -127,3 +127,15 @@ class TestUtils(unittest.TestCase): slope = utils.calculate_slope(x1, x2) self.assertEqual(slope[0], 2) def test_array_to_geom(self): array1 = np.array([[1, 2], [3, 4], [5, 6]]) array2 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) geom1 = utils.array_to_geom(array1) self.assertIsInstance(geom1, dict) self.assertRaises(ValueError, utils.array_to_geom, array2) No newline at end of file Loading
autocnet/graph/tests/test_edge.py +8 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import ogr from unittest.mock import Mock from unittest.mock import MagicMock from autocnet.examples import get_path from autocnet.graph.network import CandidateGraph from autocnet.fileio import io_gdal import pandas as pd Loading Loading @@ -75,6 +77,9 @@ class TestEdge(unittest.TestCase): self.assertAlmostEqual(e.weight['overlap_percn'], 14.285714285) def test_coverage(self): adjacency = get_path('two_image_adjacency.json') basepath = get_path('Apollo15') cg = CandidateGraph.from_adjacency(adjacency, basepath=basepath) keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], Loading Loading @@ -121,4 +126,7 @@ class TestEdge(unittest.TestCase): e.destination.geodata.pixel_to_latlon = MagicMock(side_effect = pixel_to_latlon) e.matches = matches_df self.assertRaises(AttributeError, cg.edge[0][1].coverage) self.assertEqual(e.coverage(image='destination'), 0.3) self.assertEqual(e.coverage(image='source'), 0.3)
autocnet/utils/tests/test_utils.py +13 −1 Original line number Diff line number Diff line Loading @@ -127,3 +127,15 @@ class TestUtils(unittest.TestCase): slope = utils.calculate_slope(x1, x2) self.assertEqual(slope[0], 2) def test_array_to_geom(self): array1 = np.array([[1, 2], [3, 4], [5, 6]]) array2 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) geom1 = utils.array_to_geom(array1) self.assertIsInstance(geom1, dict) self.assertRaises(ValueError, utils.array_to_geom, array2) No newline at end of file