Commit cf3537ea authored by jay's avatar jay
Browse files

Improving test coverage

parent 2d2a065e
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
from unittest import mock

import numpy as np
import pytest

@@ -53,3 +55,16 @@ def test_sift_match(a, b, threshold, expected):
def test_ransac_permut(x, y, eidx):
    xp, yp, idx = rm.ransac_permute(x, y, 0.2, 2)
    np.testing.assert_array_equal(idx, eidx)


def test_add_correspondences():
    func = 'autocnet.matcher.cpu_ring_matcher.ring_match_one'
    with mock.patch(func, return_value=1):
        in_feats = np.array([[1,1], [2,2]])
        ref_feats = np.array([[1,1],[2,2],[3,3], [4,4], [5,5]])
        tar_feats = np.array([[1.1,1.0],[1.9,1.95],[3,3], [-4,-4], [5,5]])
        
        rm.add_correspondences(in_feats, ref_feats, tar_feats, None, None,
                               (0,6), (0,6),(0,1))

+10 −0
Original line number Diff line number Diff line
from unittest import mock
import pytest

from autocnet.transformation import spatial

def test_reproject():
    with mock.patch('pyproj.transform', return_value=[1,1,1]) as mock_pyproj:
        res = spatial.reproject([1,1,1], 10, 10, 'geocent', 'latlon')
        mock_pyproj.assert_called_once()
        assert res == (1,1,1)