Skip to content

Commit

Permalink
tests expect DuplicateTermError
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Apr 4, 2021
1 parent a89eeb9 commit 56ba51a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ anchorpoint>=0.4.4
apispec[validation]~=4.3.0
marshmallow>=3.10
legislice>=0.5.0
git+git://github.com/mscarey/nettlesome.git@c7665739d9eb60dccb3ad6ba48626f3e6d84d92d#egg=nettlesome
git+git://github.com/mscarey/nettlesome.git@c1c680b542ce74edc39747d32ea024ff24363ae6#egg=nettlesome
pint>=0.15
python-dotenv
python-slugify
Expand Down
14 changes: 8 additions & 6 deletions tests/statements/test_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from nettlesome.quantities import Comparison, Q_
from nettlesome.statements import Statement

from authorityspoke.facts import Fact


class TestStatements:
def test_build_fact(self):
Expand Down Expand Up @@ -102,15 +104,15 @@ def test_new_context_replace_fact(self):

def test_too_much_info_to_change_context(self):
"""Test that a list of terms to replace requires "changes" to be consistent."""
statement = Statement(
statement = Fact(
"$person1 loved $person2",
terms=[Entity("Donald"), Entity("Daisy")],
)
with pytest.raises(ValueError):
statement.new_context(
changes=Entity("Mickey"),
terms_to_replace=[Entity("Donald"), Entity("Daisy")],
)
new = statement.new_context(
changes=Entity("Mickey"),
terms_to_replace=[Entity("Donald"), Entity("Daisy")],
)
assert "<Mickey> loved <Daisy>" in str(new)

def test_get_factor_from_recursive_search(self):
predicate_shot = Predicate("$shooter shot $victim")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import pytest

from nettlesome.terms import ContextRegister, Explanation, TermSequence, means
from nettlesome.terms import ContextRegister, DuplicateTermError
from nettlesome.terms import Explanation, TermSequence, means
from nettlesome.entities import Entity
from nettlesome.predicates import Predicate
from nettlesome.quantities import Comparison, Q_
Expand Down Expand Up @@ -92,7 +93,7 @@ def test_repeating_entity_string(self, make_predicate):
"""I'm not convinced that a model of a Fact ever needs to include
multiple references to the same Entity just because the name of the
Entity appears more than once in the Predicate."""
with pytest.raises(ValueError):
with pytest.raises(DuplicateTermError):
Fact(
make_predicate["p_three_entities"],
terms=[Entity("Al"), Entity("Bob"), Entity("Al")],
Expand Down

0 comments on commit 56ba51a

Please sign in to comment.