Implement checks for raising messages with exceptions (#1113)
* Implement checks for messages being raised with exceptions (Fixes #1080) * Add self.assertRaisesWithMessage method to relevant exercise tests - Uses self.assertRaisesRegex - Checks only for the presence of a message, not content * Add meaningful messages to failing examples * octal: Switch to using a context manager for exception tests * Add note regarding error messages to the insert * simple-linked-list: Move hints.md to correct location * simple-cipher: Remove extra whitespace from lines * collatz-conjecture: Update hints.md * Regenerate README to include exceptions section
This commit is contained in:
committed by
Corey McCandless
parent
2f93a626f1
commit
f53e2ef08b
@@ -42,7 +42,7 @@ class LinkedList(object):
|
||||
|
||||
def head(self):
|
||||
if self._head is None:
|
||||
raise EmptyListException()
|
||||
raise EmptyListException("The list is empty")
|
||||
return self._head
|
||||
|
||||
def push(self, value):
|
||||
@@ -53,7 +53,7 @@ class LinkedList(object):
|
||||
|
||||
def pop(self):
|
||||
if self._head is None:
|
||||
raise EmptyListException()
|
||||
raise EmptyListException("The list is empty")
|
||||
self._len -= 1
|
||||
ret = self._head.value()
|
||||
self._head = self._head.next()
|
||||
|
||||
Reference in New Issue
Block a user