Skip to content

Commit

Permalink
remove date parameter from Pleading
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Jun 5, 2019
1 parent 6e4936c commit 65ba533
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
20 changes: 3 additions & 17 deletions authorityspoke/factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ def add_content_references(
content: str, mentioned: List[Factor], placeholder: str
) -> Tuple[str, List[Factor]]:
"""
:param content: the content for the :class:`Fact`\'s Predicate
:param content:
the content for the :class:`Fact`\'s :class:`Predicate`
:param mentioned:
list of :class:`Factor`\s with names that could be
Expand Down Expand Up @@ -904,28 +905,13 @@ class Pleading(Factor):
"""

filer: Optional["Entity"] = None
date: Optional[datetime.date] = None
name: Optional[str] = None
absent: bool = False
generic: bool = False
context_factor_names: ClassVar = ("filer",)

def _equal_if_concrete(self, other: Pleading) -> bool:
if self.date != other.date:
return False
return super()._equal_if_concrete(other)

def _implies_if_concrete(self, other: Pleading):
# TODO: allow the same kind of comparisons as Predicate.quantity
if self.date != other.date:
return False
return super()._implies_if_concrete(other)

def __str__(self):
string = (
f'{("filed by " + str(self.filer) if self.filer else "")}'
+ f'{("received on " + str(self.date)) if self.date else ""}'
)
string = f'{("filed by " + str(self.filer) if self.filer else "")}'
return super().__str__().format(string)


Expand Down
16 changes: 16 additions & 0 deletions tests/test_enactments.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,28 @@ def test_implication_by_factor_fails(self, make_enactment, watt_factor):
with pytest.raises(TypeError):
assert not dp5 < f1

def test_constitution_effective_date(self, make_regime):
ex_post_facto_provision = Enactment.from_dict(
{"path": "/us/const/article-I/9/3"}, regime=make_regime
)
assert ex_post_facto_provision.effective_date == datetime.date(1788, 9, 13)

def test_bill_of_rights_effective_date(self, make_enactment):
# December 15, 1791
assert make_enactment["search_clause"].effective_date == datetime.date(
1791, 12, 15
)

def test_12th_A_effective_date(self, make_regime):
"""
This tests different parsing code because the date is
in the format "dated the 25th of September, 1804"
"""
amendment_12 = Enactment.from_dict(
{"path": "/us/const/amendment-XII"}, regime=make_regime
)
assert amendment_12.effective_date == datetime.date(1804, 9, 25)

def test_14th_A_effective_date(self, make_enactment):
# July 28, 1868
assert make_enactment["due_process_14"].effective_date == datetime.date(
Expand Down

0 comments on commit 65ba533

Please sign in to comment.