Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queen Attack - Improve clarity of errors #3706

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exercises/practice/queen-attack/.meta/example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class Queen:
def __init__(self, row, column):
if row < 0:
raise ValueError('row not positive')
raise ValueError('row is negative')
if not 0 <= row <= 7:
raise ValueError('row not on board')
if column < 0:
raise ValueError('column not positive')
raise ValueError('column is negative')
if not 0 <= column <= 7:
raise ValueError('column not on board')
self.row = row
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/queen-attack/queen_attack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_queen_must_have_positive_row(self):
with self.assertRaises(ValueError) as err:
Queen(-2, 2)
self.assertEqual(type(err.exception), ValueError)
self.assertEqual(err.exception.args[0], "row not positive")
self.assertEqual(err.exception.args[0], "row is negative")

def test_queen_must_have_row_on_board(self):
with self.assertRaises(ValueError) as err:
Expand All @@ -30,7 +30,7 @@ def test_queen_must_have_positive_column(self):
with self.assertRaises(ValueError) as err:
Queen(2, -2)
self.assertEqual(type(err.exception), ValueError)
self.assertEqual(err.exception.args[0], "column not positive")
self.assertEqual(err.exception.args[0], "column is negative")

def test_queen_must_have_column_on_board(self):
with self.assertRaises(ValueError) as err:
Expand Down
Loading