コード例 #1
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_correct_context_after_loading_rules(self, fake_beard_client):
     beard_rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                                   client=fake_beard_client)
     elements_of_offense = beard_rules[11]
     assert len(elements_of_offense.despite) == 1
     assert (elements_of_offense.despite[0].generic_terms()[0].name ==
             "the Department of Beards")
コード例 #2
0
    def test_dump_holdings_with_comparison(self, fake_usc_client):

        holdings = read_holdings_from_file("holding_watt.yaml",
                                           client=fake_usc_client)
        assert "was no more than 35 foot" in str(holdings[1])
        dumped = holdings[1].dict()
        predicate = dumped["rule"]["procedure"]["inputs"][3]["predicate"]
        assert predicate["quantity_range"]["quantity"] == "35 foot"
コード例 #3
0
    def test_posit_holdings(self, make_response):
        client = FakeClient(responses=make_response)

        oracle_dict = load_decision("oracle_h.json")
        lotus_dict = load_decision("lotus_h.json")
        oracle = Decision(**oracle_dict)
        lotus = Decision(**lotus_dict)

        oracle_h = read_holdings_from_file("holding_oracle.yaml",
                                           client=client)
        lotus_h = read_holdings_from_file("holding_lotus.yaml", client=client)

        oracle_reading = DecisionReading(decision=oracle)
        lotus_reading = DecisionReading(decision=lotus)

        oracle_reading.posit(holdings=oracle_h)
        lotus_reading.posit(holdings=lotus_h)

        assert lotus_reading.contradicts(oracle_reading)
コード例 #4
0
 def test_pass_holdings_to_decision_reading_constructor(
         self, make_decision, make_response):
     mock_client = FakeClient(responses=make_response)
     oracle = make_decision["oracle"]
     oracle_holdings = read_holdings_from_file("holding_oracle.yaml",
                                               client=mock_client)
     oracle_reading = DecisionReading(decision=oracle)
     oracle_reading.posit(oracle_holdings)
     assert (oracle_reading.opinion_readings[0].holdings[0].enactments[0].
             node == "/us/usc/t17/s102/a")
コード例 #5
0
    def test_holding_flagged_exclusive(
        self,
        e_securing_exclusive_right_to_writings,
        e_copyright_requires_originality,
        make_response,
    ):
        """
        Test that "exclusive" flag doesn't mess up the holding where it's placed.

        Test whether the Feist opinion object includes a holding
        with the output "Rural's telephone directory
        was copyrightable" and the input "Rural's telephone
        directory was original", when that holding was marked
        "exclusive" in the JSON.

        `originality_rule` will be a little broader because it's based on
        less Enactment text
        """
        fake_client = FakeClient(responses=make_response)
        holdings = read_holdings_from_file("holding_feist.yaml",
                                           client=fake_client)

        directory = Entity(name="Rural's telephone directory")
        original = Fact(
            predicate=Predicate(content="$work was an original work"),
            terms=directory)
        copyrightable = Fact(
            predicate=Predicate(content="$work was copyrightable"),
            terms=directory)
        originality_enactments = [
            e_securing_exclusive_right_to_writings,
            e_copyright_requires_originality,
        ]
        originality_rule = Rule(
            procedure=Procedure(outputs=copyrightable, inputs=original),
            mandatory=False,
            universal=False,
            enactments=originality_enactments,
        )
        assert any(
            originality_rule.implies(feist_holding.rule)
            for feist_holding in holdings)
コード例 #6
0
ファイル: test_load.py プロジェクト: mscarey/AuthoritySpoke
 def test_read_holdings_in_nested_rule(self):
     watt_holdings = read_holdings_from_file("holding_watt.yaml", client=self.client)
     assert watt_holdings[4].inputs[0].terms[0].name == "Hideaway Lodge"
コード例 #7
0
ファイル: test_load.py プロジェクト: mscarey/AuthoritySpoke
 def test_read_holdings_from_file(self):
     oracle_holdings = read_holdings_from_file(
         "holding_oracle.yaml", client=self.client
     )
     assert oracle_holdings[0]
コード例 #8
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_read_rules_without_regime(self, fake_beard_client):
     beard_rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                                   client=fake_beard_client)
     assert beard_rules[0].inputs[0].short_string == (
         "the fact that <the suspected beard> was facial hair")
コード例 #9
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_rule_with_exhibit_as_context_factor(self, fake_beard_client):
     rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                             client=fake_beard_client)
     exhibit = rules[5].inputs[0].terms[2]
     assert isinstance(exhibit, Exhibit)
コード例 #10
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_rule_short_string(self, fake_beard_client):
     beard_rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                                   client=fake_beard_client)
     assert beard_rules[0].rule.short_string.lower().startswith("the rule")
コード例 #11
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_imported_rule_is_type_rule(self, fake_beard_client):
     beard_rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                                   client=fake_beard_client)
     assert isinstance(beard_rules[0].rule, Rule)
コード例 #12
0
ファイル: test_rule.py プロジェクト: mscarey/AuthoritySpoke
 def test_loading_rules(self, fake_beard_client):
     beard_rules = loaders.read_holdings_from_file("beard_rules.yaml",
                                                   client=fake_beard_client)
     assert (beard_rules[0].outputs[0].predicate.content ==
             "${the_suspected_beard} was a beard")