Skip to content
Snippets Groups Projects
Commit bd221efd authored by Adam J. Jackson's avatar Adam J. Jackson
Browse files

Abins Instrument: use NotImplementedError for method stubs

Abins uses a base class for Instruments, which defines a couple of
methods returning None. None is not the right response if these
methods were not adapted to a child class; use NotImplementedError to
mark these more clearly.
parent 8d999994
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ class Instrument(object):
:param input_data: data from which Q2 should be calculated
:returns: numpy array with Q2 data
"""
return None
raise NotImplementedError()
def convolve_with_resolution_function(self, frequencies=None, bins=None, s_dft=None, scheme='auto'):
"""
......@@ -37,8 +37,8 @@ class Instrument(object):
'auto' should select something sensible.
:type scheme: str
"""
return None
"""
raise NotImplementedError()
def __str__(self):
return self._name
......
# 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
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, division, print_function)
import unittest
from AbinsModules.Instruments.Instrument import Instrument
class AbinsInstrumentTest(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()
if __name__ == '__main__':
unittest.main()
......@@ -9,6 +9,7 @@ set ( TEST_PY_FILES
AbinsCalculateSPowderTest.py
AbinsDWSingleCrystalDataTest.py
AbinsFrequencyPowderGeneratorTest.py
AbinsInstrumentTest.py
AbinsIOmoduleTest.py
AbinsKpointsDataTest.py
AbinsLoadCASTEPTest.py
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment