Skip to content

Commit

Permalink
make dotenv a regular dependency, not dev-only
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Jan 1, 2020
1 parent 76876f4 commit 8cc5ee3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ beautifulsoup4 = ">=4.8.1"
lxml = "*"
marshmallow = ">=3.2.2"
pint = ">=0.9"
python-dotenv = "*"
requests = "*"


Expand All @@ -30,7 +31,6 @@ pydocstyle = "*"
pylint = "*"
pytest = ">=5.3.2"
pytest-cov = "*"
python-dotenv = "*"
pytest-profiling = "*"
pytest-vcr = "*"
rope = "*"
Expand Down
7 changes: 5 additions & 2 deletions example_data/holdings/beard_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"source": "/au/act/1934/47/1/4/chapeau"
},
{
"source": "/au/act/1934/47/1/4/a"
"source": "/au/act/1934/47/1/4/a",
"suffix": ", or"
}
],
"universal": true
Expand Down Expand Up @@ -248,7 +249,9 @@
},
{
"source": "/au/act/1934/47/3/7B/2"
},
}
],
"enactments_despite": [
{
"source": "/au/act/1934/47/4/11"
}
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pytest-cov
pytest-profiling
pytest-vcr
pytest>=5.3.2
python-dotenv
rope
setuptools
sphinx-autodoc-typehints
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ beautifulsoup4>=4.8.1
lxml
marshmallow>=3.2.2
pint>=0.9
python-dotenv
requests
29 changes: 27 additions & 2 deletions tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from authorityspoke.procedures import Procedure
from authorityspoke.rules import Rule

from authorityspoke.io import loaders, readers


class TestRules:
def test_enactment_type_in_str(self, make_holding):
Expand Down Expand Up @@ -779,7 +781,31 @@ def test_union_inconsistent_outputs(self, make_opinion_with_holding):
assert feist_copyrightable | oracle_copyrightable is None


class TestBuildRules:
class TestStatuteRules:
"""
Tests from the statute_rules Jupyter Notebook.
"""

def test_greater_than_implies_equal(self, make_code, make_beard_rule):
beard_act = make_code["beard_act"]
beard_dictionary = loaders.load_holdings("beard_rules.json")
beard_dictionary[0]["inputs"][1][
"content"
] = "the length of the suspected beard was = 8 millimetres"
longer_hair_rule = readers.read_rule(beard_dictionary[0], beard_act)
assert make_beard_rule[0].implies(longer_hair_rule)

def test_greater_than_contradicts_not_greater(self, make_code, make_beard_rule):
beard_act = make_code["beard_act"]
beard_dictionary = loaders.load_holdings("beard_rules.json")
beard_dictionary[1]["inputs"][1][
"content"
] = "the length of the suspected beard was >= 12 inches"
beard_dictionary[1]["outputs"][0]["truth"] = False
beard_dictionary[1]["mandatory"] = True
long_hair_is_not_a_beard = readers.read_rule(beard_dictionary[1], beard_act)
assert make_beard_rule[1].contradicts(long_hair_is_not_a_beard)

@pytest.mark.parametrize(
(
"facial_hair_over_5mm, facial_hair_on_or_below_chin, "
Expand Down Expand Up @@ -843,7 +869,6 @@ def test_is_beard_implied(
source="/au/act/1934/47/1/4/", code=make_code["beard_act"]
),
)
# assert make_beard_rule[0].inputs[1].contradicts(hypothetical.inputs[1])
meets_chin_test = make_beard_rule[0].implies(hypothetical)
meets_ear_test = make_beard_rule[1].implies(hypothetical)
assert outcome == meets_chin_test or meets_ear_test

0 comments on commit 8cc5ee3

Please sign in to comment.