示例#1
0
 def test_ordered_results_has_cache(self):
     """
     Test that a shallow copy of the cached list is returned when there is
     a cache.
     """
     iqrs = IqrSession()
     # Simulate there being a cache
     iqrs._ordered_pos = ['simulated', 'cache']
     actual = iqrs.get_positive_adjudication_relevancy()
     assert actual == iqrs._ordered_pos
     assert id(actual) != id(iqrs._ordered_pos)
示例#2
0
    def test_get_positive_adjudication_relevancy_has_cache(self):
        """
        Test that a shallow copy of the cached list is returned if there is a
        cache.
        """
        iqrs = IqrSession()

        iqrs._ordered_pos = ['simulation', 'cache']
        actual = iqrs.get_positive_adjudication_relevancy()
        assert actual == ['simulation', 'cache']
        assert id(actual) != id(iqrs._ordered_pos)
示例#3
0
    def test_adjudicate_cache_resetting_negative(self):
        """
        Test results view cache resetting functionality on adjudicating certain
        ways.
        """
        e = DescriptorMemoryElement('', 0).set_vector([0])

        iqrs = IqrSession()
        iqrs._ordered_pos = True
        iqrs._ordered_neg = True
        iqrs._ordered_non_adj = True

        # Check that adding a positive adjudication resets the positive and
        # non-adjudicated result caches.
        iqrs.adjudicate(new_negatives=[e])
        assert iqrs._ordered_pos is True  # NOT reset
        assert iqrs._ordered_neg is None  # reset
        assert iqrs._ordered_non_adj is None  # reset