Skip to content

Commit

Permalink
change method for FakeEnactment finding file
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Jun 16, 2021
1 parent dcec5d1 commit 17044f6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions authorityspoke/io/fake_enactments.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from legislice.download import Client, normalize_path, LegislicePathError, RawEnactment
from legislice.enactments import CrossReference, Enactment

from authorityspoke.io import filepaths


# A dict indexing responses by iso-format date strings.
ResponsesByDate = Dict[str, Dict]
Expand Down Expand Up @@ -48,9 +50,9 @@ def __init__(self, responses: ResponsesByDateByPath):

@classmethod
def from_file(cls, filename: str) -> FakeClient:
parent_directory = Path(__file__).resolve().parents[2]
responses_filepath = parent_directory / "example_data" / "responses" / filename
with open(responses_filepath, "r") as f:
responses_filepath = filepaths.get_directory_path("responses")
response_path = responses_filepath / filename
with open(response_path, "r") as f:
responses = json.load(f)
return cls(responses)

Expand Down

0 comments on commit 17044f6

Please sign in to comment.