Skip to content

Commit

Permalink
Procedure.terms doesn't include FactorGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Apr 3, 2021
1 parent 372f407 commit a89eeb9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions authorityspoke/procedures.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Explanation,
new_context_helper,
Term,
TermSequence,
)
from nettlesome.factors import Factor
from nettlesome.groups import FactorGroup
Expand Down Expand Up @@ -257,6 +258,22 @@ def recursive_terms(self) -> Dict[str, Term]:
answers.update(context.recursive_terms)
return answers

@property
def terms(self) -> TermSequence:
r"""
Get :class:`Factor`\s used in comparisons with other :class:`Factor`\s.
:returns:
a tuple of attributes that are designated as the ``terms``
for whichever subclass of :class:`Factor` calls this method. These
can be used for comparing objects using :meth:`consistent_with`
"""
result: List[Term] = []
result.extend(self.outputs)
result.extend(self.inputs)
result.extend(self.despite)
return TermSequence(result)

def generic_terms_by_str(self) -> Dict[str, Term]:
r"""
:class:`.Factor`\s that can be replaced without changing ``self``\s meaning.
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_holding.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def test_enactment_has_subsection(self, make_response):
mock_client = FakeClient(responses=make_response)
to_read = load_holdings("holding_lotus.json")
holdings = readers.read_holdings(to_read, client=mock_client)
assert holdings[8].enactments[0].source.split("/")[-1] == "b"
assert holdings[8].enactments[0].node.split("/")[-1] == "b"

def test_enactment_text_limited_to_subsection(self, make_response):
mock_client = FakeClient(responses=make_response)
Expand Down
2 changes: 1 addition & 1 deletion tests/statements/test_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_get_factor_from_recursive_search(self):
predicate_told = Predicate("$speaker told $hearer $statement")
shot = Statement(predicate_shot, terms=[Entity("Alice"), Entity("Bob")])
told = Statement(predicate_told, terms=[Entity("Henry"), Entity("Jenna"), shot])
factors = told.recursive_factors
factors = told.recursive_terms
assert factors["<Alice>"].compare_keys(Entity("Alice"))

def test_new_concrete_context(self):
Expand Down

0 comments on commit a89eeb9

Please sign in to comment.