コード例 #1
0
 def test_equal_na_vs_non_na(self):
     """Test that consensus_vote() returns an evaluation when an equal number of N/A and non-N/A votes have been cast."""
     for vote in [
             Eval.very_inconsistent, Eval.neutral, Eval.very_consistent
     ]:
         self.assertEqual(consensus_vote([vote, Eval.not_applicable]), vote)
         self.assertEqual(consensus_vote([Eval.not_applicable, vote]), vote)
コード例 #2
0
 def test_round_toward_neutral(self):
     """Test that consensus_vote() rounds the vote toward a neutral assessment."""
     self.assertEqual(
         consensus_vote([Eval.consistent, Eval.very_consistent]),
         Eval.consistent)
     self.assertEqual(
         consensus_vote([Eval.inconsistent, Eval.very_inconsistent]),
         Eval.inconsistent)
コード例 #3
0
 def test_no_votes_has_no_consensus(self):
     """Test that consensus_vote() returns None if no votes have been cast."""
     self.assertIsNone(consensus_vote([]))
コード例 #4
0
 def test_none_na_consensus_for_single_vote(self):
     """Test that consensus_vote() returns the evaluation if only a single vote is cast."""
     self.assertEqual(consensus_vote([Eval.consistent]), Eval.consistent)
コード例 #5
0
 def test_na_consensus_for_single_vote(self):
     """Test that consensus_vote() returns N/A if only a single N/A vote is cast"""
     self.assertEqual(consensus_vote([Eval.not_applicable]),
                      Eval.not_applicable)