|
15 | 15 |
|
16 | 16 | """Tests for the 'bucket' plugin."""
|
17 | 17 |
|
18 |
| -from nose.tools import raises |
19 | 18 | from _common import unittest
|
20 | 19 | from beetsplug import bucket
|
21 | 20 | from beets import config, ui
|
@@ -129,26 +128,24 @@ def test_alpha_regex_mix(self):
|
129 | 128 | self.assertEqual(self.plugin._tmpl_bucket('…and Oceans'), 'A - D')
|
130 | 129 | self.assertEqual(self.plugin._tmpl_bucket('Eagles'), 'E - L')
|
131 | 130 |
|
132 |
| - @raises(ui.UserError) |
133 | 131 | def test_bad_alpha_range_def(self):
|
134 |
| - """If bad alpha range definition, a UserError is raised""" |
135 |
| - self._setup_config(bucket_alpha=['$%']) |
136 |
| - self.assertEqual(self.plugin._tmpl_bucket('errol'), 'E') |
| 132 | + """If bad alpha range definition, a UserError is raised.""" |
| 133 | + with self.assertRaises(ui.UserError): |
| 134 | + self._setup_config(bucket_alpha=['$%']) |
137 | 135 |
|
138 |
| - @raises(ui.UserError) |
139 | 136 | def test_bad_year_range_def_no4digits(self):
|
140 | 137 | """If bad year range definition, a UserError is raised.
|
141 |
| - Range origin must be expressed on 4 digits.""" |
142 |
| - self._setup_config(bucket_year=['62-64']) |
143 |
| - # from year must be expressed on 4 digits |
144 |
| - self.assertEqual(self.plugin._tmpl_bucket('1963'), '62-64') |
| 138 | + Range origin must be expressed on 4 digits. |
| 139 | + """ |
| 140 | + with self.assertRaises(ui.UserError): |
| 141 | + self._setup_config(bucket_year=['62-64']) |
145 | 142 |
|
146 |
| - @raises(ui.UserError) |
147 | 143 | def test_bad_year_range_def_nodigits(self):
|
148 | 144 | """If bad year range definition, a UserError is raised.
|
149 |
| - At least the range origin must be declared.""" |
150 |
| - self._setup_config(bucket_year=['nodigits']) |
151 |
| - self.assertEqual(self.plugin._tmpl_bucket('1963'), '62-64') |
| 145 | + At least the range origin must be declared. |
| 146 | + """ |
| 147 | + with self.assertRaises(ui.UserError): |
| 148 | + self._setup_config(bucket_year=['nodigits']) |
152 | 149 |
|
153 | 150 |
|
154 | 151 | def suite():
|
|
0 commit comments