Use assertRaises to check for the NameError

Also corrected spelling of a word.
This commit is contained in:
Mìcheal A Colquhoun 2017-03-04 11:42:24 +11:00 committed by Nick Hall
parent 0cba44146a
commit 539330309b

View File

@ -65,10 +65,9 @@ class TestCallback(unittest.TestCase):
def borked(i): def borked(i):
""" """
this intentionally raises a NameError exception This intentionally raises a NameError exception
FIXME: could use an explanation
or perhaps some explicit Try/Except code
""" """
with self.assertRaises(NameError):
rubish.append(i) rubish.append(i)
t = TestSignals() t = TestSignals()
@ -87,7 +86,7 @@ class TestCallback(unittest.TestCase):
log = _log log = _log
self.assertEqual(len(rl), 1, "No signal emitted") self.assertEqual(len(rl), 1, "No signal emitted")
self.assertEqual(rl[0], 1, "Wrong argument recieved") self.assertEqual(rl[0], 1, "Wrong argument received")
def test_disconnect(self): def test_disconnect(self):