Commit 872ead5d authored by Jay's avatar Jay Committed by jay
Browse files

Test update to catch warning that was swapped from ValueError.

parent d53a24a9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -9,11 +9,11 @@ import pandas as pd
from autocnet.control.control import C
from autocnet.fileio import io_json
from autocnet.matcher.matcher import FlannMatcher
import autocnet.matcher.suppression_funcs as spf
from autocnet.graph.edge import Edge
from autocnet.graph.node import Node
from autocnet.vis.graph_view import plot_graph


class CandidateGraph(nx.Graph):
    """
    A NetworkX derived directed graph to store candidate overlap images.
@@ -318,6 +318,10 @@ class CandidateGraph(nx.Graph):
                                    upsampling=upsampling, template_size=template_size,
                                    search_size=search_size, tiled=tiled)

    def suppress(self, clean_keys=[], func=spf.correlation, **kwargs):
        for s, d, e in self.edges_iter(data=True):
            e.suppress(clean_keys=clean_keys, func=func, **kwargs)

    def to_filelist(self):
        """
        Generate a file list for the entire graph.
+5 −4
Original line number Diff line number Diff line
import os
import sys
import unittest
import warnings

import cv2
import numpy as np

sys.path.append(os.path.abspath('..'))

@@ -33,9 +33,10 @@ class TestMatcher(unittest.TestCase):

        fmatcher.train()

        self.assertRaises(ValueError, fmatcher.query,self.fd['AS15-M-0296_SML.png'][1],0, k=2 )
        matches = fmatcher.query(self.fd['AS15-M-0297_SML.png'][1], 1, k=2)
        self.assertEqual(len(matches), 20)
        with warnings.catch_warnings(record=True) as w:
            fmatcher.query(self.fd['AS15-M-0296_SML.png'][1],0, k=2)
            self.assertEqual(len(w), 1)
            self.assertEqual(w[0].category, UserWarning)

    def tearDown(self):
        pass