Commit 591b6cef authored by Adam Paquette's avatar Adam Paquette
Browse files

Basic outline for testing overlap

parent b6e74352
Loading
Loading
Loading
Loading
+17 −0
Changes for autocnet/graph/tests/test_edge.py: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
import unittest

from unittest.mock import patch
from unittest.mock import Mock
from unittest.mock import PropertyMock
from osgeo import ogr

import pandas as pd

@@ -44,3 +48,16 @@ class TestEdge(unittest.TestCase):
    def test_compute_fundamental_matrix(self):
        with self.assertRaises(AttributeError):
            self.edge.compute_fundamental_matrix()

    def test_overlap(self):
        wkt1 = "POLYGON ((0 40, 40 40, 40 0, 0 0, 0 40))"
        wkt2 = "POLYGON ((20 60, 60 60, 60 20, 20 20, 20 60))"

        poly1 = ogr.CreateGeometryFromWkt(wkt1)
        poly2 = ogr.CreateGeometryFromWkt(wkt2)

        with patch.object(self.edge.source.geodata, 'footprint' ,new_callable=PropertyMock) as patch_fp:
            patch_fp.return_value = poly1

        with patch.object(self.edge.destination.geodata, 'footprint' ,new_callable=PropertyMock) as patch_fp:
            patch_fp.return_value = poly2
 No newline at end of file