pyCraft/tests/test_exceptions.py

16 lines
439 B
Python
Raw Normal View History

2015-04-07 20:16:01 +02:00
from minecraft.exceptions import YggdrasilError
import unittest
class RaiseYggdrasilError(unittest.TestCase):
def test_raise_yggdrasil_error(self):
with self.assertRaises(YggdrasilError):
raise YggdrasilError
def test_raise_yggdrasil_error_message(self):
with self.assertRaises(YggdrasilError) as cm:
2015-04-07 20:16:01 +02:00
raise YggdrasilError("Error!")
self.assertEqual(str(cm.exception), "Error!")