def test_inconsistency_assumptions(self): """Test basic inconsistency() behavior. (1) a hypothesis with 3 inconsistent ratings is less consistent than a hypothesis with 2 inconsistent ratings, regardless of whether N/A or Neutral is one of the other ratings. (2) a hypothesis with a very inconsistent rating is more inconsistent than a hypothesis with not just inconsistent ratings """ h1 = inconsistency([ [Eval.very_consistent], [Eval.not_applicable], [Eval.inconsistent], [Eval.inconsistent], ]) h2 = inconsistency([ [Eval.inconsistent], [Eval.inconsistent], [Eval.neutral], [Eval.inconsistent], ]) h3 = inconsistency([ [Eval.neutral], [Eval.not_applicable], [Eval.very_consistent], [Eval.very_inconsistent], ]) self.assertLess(h1, h2) self.assertLess(h2, h3)
def test_inconsistent_evidence_has_nonzero_inconsistency(self): """Test that inconsistency() returns more than 0.0 when a evaluation is neutral or more consistent.""" for vote in [Eval.very_inconsistent, Eval.inconsistent]: self.assertGreater(inconsistency([[vote]]), 0.0)
def test_consistent_evidence_has_zero_inconsistency(self): """Test that inconsistency() returns 0.0 when a evaluation is neutral or more consistent.""" for vote in [Eval.neutral, Eval.consistent, Eval.very_consistent]: self.assertEqual(inconsistency([[vote]]), 0.0)
def test_no_evidence_has_zero_inconsistency(self): """Test that inconsistency() returns 0.0 when there is no evidence.""" self.assertEqual(inconsistency([]), 0.0)
def test_very_inconsistent_implies_more_inconsistent(self): """Test that inconsistency() returns a higher value for a hypothesis that has an inconsistent rating.""" h1 = inconsistency([[Eval.consistent], [Eval.inconsistent]]) h2 = inconsistency([[Eval.very_inconsistent], [Eval.inconsistent]]) self.assertLess(h1, h2)