Support python2.7 in instrument loading

master
Olivier Jolly 2016-01-26 11:55:09 +01:00
rodzic 42048f3360
commit 30e5973494
2 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -43,7 +43,7 @@ class RenoiseInstrument(object):
else:
try:
self.load(template_filename)
except FileNotFoundError:
except IOError:
self.load(io.BytesIO(pkgutil.get_data('rnsutils', 'data/{}'.format(template_filename))))
self.extract_sample_template()

Wyświetl plik

@ -1,6 +1,13 @@
import unittest
from rnsutils.instrument import RenoiseInstrument
def test_open_template():
# creates an empty instrument, which trigger template loading
RenoiseInstrument()
class TestParse(unittest.TestCase):
def test_open_template(self):
# creates an empty instrument, which trigger template loading
RenoiseInstrument()
def test_missing_template(self):
with self.assertRaises(Exception):
RenoiseInstrument(template_filename='I dont exist.xnri')