Skip to content

Commit 3db6af6

Browse files
authored
Merge pull request #39 from wimglenn/v0.9.3
add context to other attribute errors
2 parents e9244f6 + becc685 commit 3db6af6

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

aocd/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def answer_a(self):
196196
try:
197197
return self._get_answer(part="a")
198198
except PuzzleUnsolvedError:
199-
raise AttributeError
199+
raise AttributeError("answer_a")
200200

201201
@answer_a.setter
202202
def answer_a(self, val):
@@ -215,7 +215,7 @@ def answer_b(self):
215215
try:
216216
return self._get_answer(part="b")
217217
except PuzzleUnsolvedError:
218-
raise AttributeError
218+
raise AttributeError("answer_b")
219219

220220
@answer_b.setter
221221
def answer_b(self, val):

aocd/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def run_for(plugins, years, days, datasets, timeout=DEFAULT_TIMEOUT, autosubmit=
197197
try:
198198
expected = getattr(puzzle, "answer_" + part)
199199
except AttributeError:
200-
post = part == "a" or (part == "b" and hasattr(puzzle, "answer_a"))
200+
post = part == "a" or (part == "b" and puzzle.answered_a)
201201
if autosubmit and post:
202202
try:
203203
puzzle._submit(answer, part, reopen=reopen, quiet=True)

aocd/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.9.2"
1+
__version__ = "0.9.3"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name="advent-of-code-data",
6-
version="0.9.2",
6+
version="0.9.3",
77
description="Get your puzzle data with a single import",
88
long_description=open("README.rst").read(),
99
long_description_content_type="text/x-rst",

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_get_answer(aocd_dir):
2323
def test_get_answer_not_existing(aocd_dir, requests_mock):
2424
requests_mock.get("https://adventofcode.com/2017/day/13")
2525
puzzle = Puzzle(day=13, year=2017)
26-
with pytest.raises(AttributeError):
26+
with pytest.raises(AttributeError("answer_b")):
2727
puzzle.answer_b
2828

2929

0 commit comments

Comments
 (0)