Пример #1
0
    def test_posit_anchored_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_ah = read_anchored_holdings_from_file("holding_oracle.yaml",
                                                     client=client)
        lotus_ah = read_anchored_holdings_from_file("holding_lotus.yaml",
                                                    client=client)

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

        oracle_reading.posit(
            holdings=oracle_ah.holdings,
            named_anchors=oracle_ah.named_anchors,
            enactment_anchors=oracle_ah.enactment_anchors,
        )
        lotus_reading.posit(
            holdings=lotus_ah.holdings,
            named_anchors=lotus_ah.named_anchors,
            enactment_anchors=lotus_ah.enactment_anchors,
        )

        assert lotus_reading.contradicts(oracle_reading)
Пример #2
0
    def test_read_holding_anchors_from_yaml(self):
        anchored = read_anchored_holdings_from_file(
            "holding_mazza_alaluf.yaml", client=self.client
        )

        # holding anchor
        assert "In any event" in anchored.holdings[1].anchors.quotes[0].suffix
Пример #3
0
 def test_decision_posits_holdings_with_anchors(self, make_response):
     mock_client = FakeClient(responses=make_response)
     oracle_holdings_with_anchors = loaders.read_anchored_holdings_from_file(
         "holding_oracle.yaml", client=mock_client)
     reading = DecisionReading(decision=Decision(
         decision_date=date(2019, 1, 1)))
     reading.posit(oracle_holdings_with_anchors)
     assert len(reading.holdings) == 20
Пример #4
0
 def test_decision_posits_holding(self, fake_usc_client, make_decision):
     lotus_analysis = read_anchored_holdings_from_file(
         "holding_lotus.yaml", client=fake_usc_client)
     lotus_reading = DecisionReading(decision=make_decision["lotus"])
     lotus_reading.posit(lotus_analysis)
     assert len(lotus_reading.majority.holdings) == len(
         lotus_analysis.holdings)
     assert str(lotus_reading).startswith(
         "Reading for Lotus Development Corp.")
Пример #5
0
    def test_read_enactment_anchors_from_yaml(self):
        anchored = read_anchored_holdings_from_file(
            "holding_mazza_alaluf.yaml", client=self.client
        )

        # enactment anchor
        key = str(anchored.holdings[1].holding.enactments_despite[0])
        quotes = anchored.get_enactment_anchors(key).quotes
        assert "domestic financial" in quotes[0].exact
Пример #6
0
 def test_decision_with_opinion_reading_posits_holding(
         self, fake_usc_client):
     lotus_analysis = read_anchored_holdings_from_file(
         "holding_lotus.yaml", client=fake_usc_client)
     decision_reading = DecisionReading(
         decision=Decision(decision_date=date(2000, 2, 2)),
         opinion_readings=[OpinionReading(opinion_type="plurality")],
     )
     decision_reading.posit(lotus_analysis)
     assert len(decision_reading.holdings) == len(lotus_analysis.holdings)
Пример #7
0
 def test_read_holdings_from_yaml(self):
     anchored = read_anchored_holdings_from_file(
         "holding_mazza_alaluf.yaml", client=self.client
     )
     # factor anchor
     key = "the fact that <Turismo Costa Brava> was a money transmitting business"
     assert (
         "Turismo conducted substantial money transmitting business"
         in anchored.get_term_anchors(key).quotes[0].exact
     )
Пример #8
0
 def test_load_from_fake_client(self):
     fake_client = FakeClient.from_file("usc.json")
     filepath = filepaths.make_filepath(filename="holding_mazza_alaluf.yaml")
     result = read_anchored_holdings_from_file(filepath=filepath, client=fake_client)
     key = "the fact it was false that <Turismo Costa Brava> was a domestic financial institution"
     anchors = result.get_term_anchors(key)
     assert anchors.quotes[0].exact.startswith(
         "without respect to whether or not Turismo"
     )
     assert len(result.holdings) == 2
Пример #9
0
 def test_load_and_posit_holdings_with_anchors(self, make_response):
     """
     Test that Opinion.posit can take a HoldingsIndexed as the only argument.
     Trying to combine several tasks that normally happen together, into a single command.
     """
     mock_client = FakeClient(responses=make_response)
     oracle_holdings_with_anchors = loaders.read_anchored_holdings_from_file(
         "holding_oracle.yaml", client=mock_client)
     reading = OpinionReading()
     reading.posit(oracle_holdings_with_anchors)
     assert len(reading.holdings) == 20
Пример #10
0
 def test_error_decision_with_no_majority_posits_holding(
         self, fake_usc_client):
     lotus_analysis = read_anchored_holdings_from_file(
         "holding_lotus.yaml", client=fake_usc_client)
     reading1 = OpinionReading(opinion_type="plurality")
     reading2 = OpinionReading(opinion_type="concurring")
     decision_reading = DecisionReading(
         decision=Decision(decision_date=date(2000, 2, 2)),
         opinion_readings=[reading1, reading2],
     )
     with pytest.raises(AttributeError):
         decision_reading.posit(lotus_analysis)
Пример #11
0
    def test_multiple_non_Factor_selectors_for_Holding(self):
        """
        The Holding-level TextQuoteSelectors should be built from this:

        "text": [
            "Census data therefore do not|trigger|copyright",
            "|may|possess the requisite originality"
            ]
        """
        client = FakeClient.from_file("usc.json")
        holdings = loaders.read_anchored_holdings_from_file(
            "holding_feist.yaml", client=client)
        assert len(holdings.holdings[6].anchors.quotes) == 2
Пример #12
0
 def test_load_and_read_yaml(self):
     both_holdings_with_anchors = read_anchored_holdings_from_file(
         filename="holding_mazza_alaluf.yaml", client=self.client
     )
     assert len(both_holdings_with_anchors.holdings) == 2