Skip to content

Commit

Permalink
explanations_implication will fill in missing OpinionReading
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Jul 26, 2021
1 parent 8fc64e4 commit 1cf0f2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions authorityspoke/decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def explain_implication(
def explanations_implication(
self, other: Union[Decision, Opinion, Holding, Rule]
) -> Iterator[Explanation]:
if isinstance(other, Decision):
if self.majority and other.majority:
if isinstance(other, DecisionReading):
if self.get_majority() and other.get_majority():
yield from self.majority.explanations_implication(other.majority)
elif isinstance(other, (Rule, Holding, Opinion)):
if self.majority:
elif isinstance(other, (Rule, Holding, OpinionReading)):
if self.get_majority():
yield from self.majority.explanations_implication(other)
else:
raise TypeError(
Expand Down
6 changes: 4 additions & 2 deletions tests/test_decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ def test_decision_implies_decision_without_holdings(
):
oracle = make_decision_with_holding["oracle"]
blank = make_decision["lotus"]
explanation = oracle.explain_implication(blank)
blank_reading = DecisionReading(decision=blank)
explanation = oracle.explain_implication(blank_reading)
assert not explanation.reasons

def test_no_holdings_of_blank_decision(self):
blank = Decision(decision_date=datetime.date(2000, 1, 2))
assert len(blank.holdings) == 0
reading = DecisionReading(decision=blank)
assert len(reading.holdings) == 0

# @pytest.mark.skip(reason="slow")
def test_decision_implies_its_opinion(self, make_decision_with_holding):
Expand Down

0 comments on commit 1cf0f2e

Please sign in to comment.