forked from mopidy/mopidy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_exceptions.py
More file actions
48 lines (33 loc) · 1.58 KB
/
test_exceptions.py
File metadata and controls
48 lines (33 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from __future__ import absolute_import, unicode_literals
import unittest
from mopidy import exceptions
class ExceptionsTest(unittest.TestCase):
def test_exception_can_include_message_string(self):
exc = exceptions.MopidyException('foo')
self.assertEqual(exc.message, 'foo')
self.assertEqual(str(exc), 'foo')
def test_backend_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.BackendError, exceptions.MopidyException))
def test_extension_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.ExtensionError, exceptions.MopidyException))
def test_find_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.FindError, exceptions.MopidyException))
def test_find_error_can_store_an_errno(self):
exc = exceptions.FindError('msg', errno=1234)
self.assertEqual(exc.message, 'msg')
self.assertEqual(exc.errno, 1234)
def test_frontend_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.FrontendError, exceptions.MopidyException))
def test_mixer_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.MixerError, exceptions.MopidyException))
def test_scanner_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.ScannerError, exceptions.MopidyException))
def test_audio_error_is_a_mopidy_exception(self):
self.assert_(issubclass(
exceptions.AudioException, exceptions.MopidyException))