Skip to content

Commit

Permalink
add tests for Rule union operation
Browse files Browse the repository at this point in the history
Closes #31
  • Loading branch information
mscarey committed Jun 26, 2019
1 parent e19e73c commit 1062887
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ def test_add_complex_rule(self, make_factor, make_complex_rule):
assert new_rule.inputs == make_complex_rule["accept_relevance_testimony_ALL"].inputs
assert make_complex_rule["accept_murder_fact_from_relevance"].outputs[0] in new_rule.outputs

class TestUnion:

def test_union_contradictory_outputs(self, make_opinion_with_holding):
"""
Test that even when two Rules don't contradict each other,
Expand All @@ -772,4 +774,24 @@ def test_union_contradictory_outputs(self, make_opinion_with_holding):
assert feist.holdings[1].outputs[0].contradicts(feist.holdings[2].outputs[0])
assert feist.holdings[1] | feist.holdings[2] == None

def test_union_basic(self, make_opinion_with_holding):
feist = make_opinion_with_holding["feist_majority"]
new_rule = feist.holdings[0] | feist.holdings[2]
assert len(new_rule.inputs) == 2
assert len(new_rule.outputs) == 1
assert len(new_rule.enactments) == 4

def test_union_longer(self, make_opinion_with_holding):
feist = make_opinion_with_holding["feist_majority"]
new_rule = feist.holdings[5] | feist.holdings[7]
assert len(new_rule.inputs) == 6
assert len(new_rule.outputs) == 1
assert len(new_rule.despite) == 1
assert new_rule.universal == False
assert new_rule.mandatory == False

def test_union_neither_universal(self, make_opinion_with_holding):
feist = make_opinion_with_holding["feist_majority"]
assert(feist.holdings[9] | feist.holdings[7]) is None

# Add tests that consider differences in Enactments

0 comments on commit 1062887

Please sign in to comment.