コード例 #1
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_not_good_enough(self):
     """Tests that VOTE can decide with Not Good Enough."""
     decision = vote.vote("WONG", "HR-4264")
     self.assertEqual(decision.strategy, "Not Good Enough")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #2
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_non_constitutional_AGN(self):
     """Tests that VOTE can decide AGN with Not Constitutional."""
     decision = vote.vote("DOE", "HR-0")
     self.assertEqual(decision.strategy, "Not Constitutional")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #3
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_innoculation_AGN(self):
     """Tests that VOTE can decide AGN with Inoculation."""
     decision = vote.vote("YANG", "ANTI-HR-4800")
     self.assertEqual(decision.strategy, "Inoculation")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #4
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_could_not_pass(self):
     """Tests that VOTE can decide with Could Not Pass."""
     decision = vote.vote("WONG", "HR-900")
     self.assertEqual(decision.strategy, "Could Not Pass")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #5
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_best_for_the_country_AGN(self):
     """Tests that VOTE can decide AGN with Best for the Country."""
     decision = vote.vote("JORDAN", "HR-778")
     self.assertEqual(decision.strategy, "Best for the Country")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #6
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_change_of_heart_AGN(self):
     """Tests that VOTE can decide AGN with Change of Heart."""
     decision = vote.vote("JORDAN", "HR-779")
     self.assertEqual(decision.strategy, "Change of Heart")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #7
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_balance_the_books_AGN(self):
     """Tests that VOTE can decide AGN with Balance the Books."""
     decision = vote.vote("WILLIAMS", "HR-4264")
     self.assertEqual(decision.strategy, "Balance the Books")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #8
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_unimportant_bill_AGN(self):
     """Tests that VOTE can decide AGN with Unimportant Bill."""
     decision = vote.vote("WILLIAMS", "HR-4800")
     self.assertEqual(decision.strategy, "Unimportant Bill")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #9
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_unimportant_bill_FOR(self):
     """Tests that VOTE can decide FOR with Unimportant Bill."""
     decision = vote.vote("JORDAN", "HR-4800")
     self.assertEqual(decision.strategy, "Unimportant Bill")
     self.assertEqual(decision.result, outcomes.FOR)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #10
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_non_partisan_decision_AGN(self):
     """Tests that VOTE can decide AGN with Non-partisan Decision."""
     decision = vote.vote("SMITH", "HR-4264")
     self.assertEqual(decision.strategy, "Non-partisan Decision")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #11
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_non_partisan_decision_FOR(self):
     """Tests that VOTE can decide FOR with Non-partisan Decision."""
     decision = vote.vote("DOE", "AMD")
     self.assertEqual(decision.strategy, "Non-partisan Decision")
     self.assertEqual(decision.result, outcomes.FOR)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #12
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_minimize_adverse_effects_AGN(self):
     """Tests that VOTE can decide AGN with Minimize Adverse Effects."""
     decision = vote.vote("WONG", "HR-888")
     self.assertEqual(decision.strategy, "Minimize Adverse Effects")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #13
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_inconsistent_constituency_FOR(self):
     """Tests that VOTE can decide FOR with Inconsistent Constituency."""
     decision = vote.vote("SMITH", "AMD")
     self.assertEqual(decision.strategy, "Inconsistent Constituency")
     self.assertEqual(decision.result, outcomes.FOR)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #14
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_inconsistent_constituency_AGN(self):
     """Tests that VOTE can decide AGN with Inconsistent Constituency."""
     decision = vote.vote("DOE", "HR-4264")
     self.assertEqual(decision.strategy, "Inconsistent Constituency")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #15
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_normative_decision_AGN(self):
     """Tests that VOTE can decide AGN with Normative Decision."""
     decision = vote.vote("WILLIAMS", "HR-779")
     self.assertEqual(decision.strategy, "Normative Decision")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) == 0)
コード例 #16
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_simple_majority_AGN(self):
     """Tests that VOTE can decide AGN with Simple Majority."""
     decision = vote.vote("WONG", "HR-901")
     self.assertEqual(decision.strategy, "Simple Majority")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #17
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
 def test_simple_consensus_AGN(self):
     """Tests that VOTE can decide AGN with Simple Consensus."""
     decision = vote.vote("YANG", "AMD-IMP")
     self.assertEqual(decision.strategy, "Simple Consensus")
     self.assertEqual(decision.result, outcomes.AGN)
     self.assertTrue(len(decision.reason) > 0)
     self.assertTrue(len(decision.downside + decision.downside_record) > 0)
コード例 #18
0
ファイル: staging_test.py プロジェクト: WEB3-GForce/VOTE
    def test_popular_decision_AGN(self):
        """Tests that VOTE can decide AGN with a popular decision."""
        decision = vote.vote("DOE", "HR-4800")

        self.assertEqual(decision.result, outcomes.AGN)
        self.assertEqual(decision.strategy, "Popular Decision")
        self.assertTrue(len(decision.reason) > 0)
        self.assertEqual(len(decision.downside + decision.downside_record), 0)
コード例 #19
0
ファイル: vote_test.py プロジェクト: WEB3-GForce/VOTE
    def test_vote_success(self):
        """ Verifies decision is returned upon success."""
        strategy_hash.STRATEGY_HASH = {"AlwaysFail": AlwaysFailStrategy,
                                       "AlwaysFail2" : AlwaysFailStrategy,
                                       "AlwaysSucceed": AlwaysSucceedStrategy}
        result = vote.vote(self.MEMBER, self.BILL1)

        # Make sure that the decision is properly reached.
        self.assertEquals(result.strategy, "AlwaysSucceedStrategy")
        self.assertTrue(len(result.reason) > 0)
        self.assertTrue(len(result.downside) > 0)
コード例 #20
0
ファイル: vote_test.py プロジェクト: WEB3-GForce/VOTE
 def test_vote_bad_bill(self):
     """ Verifies that None is returned for an invalid bill identifier."""
     result = vote.vote(self.MEMBER, "Bad Bill")
     self.assertEquals(result, None)
コード例 #21
0
ファイル: vote_test.py プロジェクト: WEB3-GForce/VOTE
 def test_vote_bad_member(self):
     """ Verifies that None is returned for an invalid member identifier."""
     result = vote.vote("BAD_MEMBER", self.BILL1)
     self.assertEquals(result, None)
コード例 #22
0
ファイル: vote_test.py プロジェクト: WEB3-GForce/VOTE
 def test_vote_fail(self):
     """ Verifies proper decision returned when no decision is reached."""
     strategy_hash.STRATEGY_HASH = {"AlwaysFail": AlwaysFailStrategy}
     result = vote.vote(self.MEMBER, self.BILL1)
     self.assertEquals(result.strategy, None)