forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbinsInstrumentTest.py
41 lines (29 loc) · 1.23 KB
/
AbinsInstrumentTest.py
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
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import unittest
from abins.constants import ALL_INSTRUMENTS
from abins.instruments.instrument import Instrument
class InstrumentTest(unittest.TestCase):
def test_instrument_notimplemented(self):
instrument = Instrument()
with self.assertRaises(NotImplementedError):
instrument.calculate_q_powder()
with self.assertRaises(NotImplementedError):
instrument.convolve_with_resolution_function()
class GetInstrumentTest(unittest.TestCase):
def setUp(self):
ALL_INSTRUMENTS.append('Unimplemented')
def tearDown(self):
ALL_INSTRUMENTS.pop()
def test_instrument_notfound(self):
from abins.instruments import get_instrument
with self.assertRaises(ValueError):
get_instrument('Unheardof')
with self.assertRaises(NotImplementedError):
get_instrument('Unimplemented')
if __name__ == '__main__':
unittest.main()