Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NotImplementedError in the TestLaserSpectrum unit test. #418

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cherab/core/laser/tests/test_laserspectrum.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import unittest
import numpy as np

from cherab.core.laser.laserspectrum import LaserSpectrum
# The evaluate() method is not implemented in the base LaserSpectrum, so importing the simplest subclass.
from cherab.core.model.laser.laserspectrum import ConstantSpectrum as LaserSpectrum
from raysect.optical.spectrum import Spectrum


class TestLaserSpectrum(unittest.TestCase):

def test_laserspectrum_init(self):
Expand All @@ -24,12 +26,12 @@ def test_laserspectrum_init(self):
msg="LaserSpectrum did not raise a ValueError with max_wavelength < min_wavelength."):
LaserSpectrum(40, 30, 200)
LaserSpectrum(30, 30, 200)

# test bins > 0
with self.assertRaises(ValueError,
msg="LaserSpectrum did not raise a ValueError with max_wavelength < min_wavelength."):
LaserSpectrum(30, 30, 0)
LaserSpectrum(30, 30, -1)
msg="LaserSpectrum did not raise a ValueError with bins <= 0."):
LaserSpectrum(30, 40, 0)
LaserSpectrum(30, 40, -1)

def test_laserspectrum_changes(self):
laser_spectrum = LaserSpectrum(100, 200, 100)
Expand Down Expand Up @@ -59,4 +61,4 @@ def test_laserspectrum_changes(self):
# test caching of spectrum data, behaviour should be consistent with raysect.optical.spectrum.Spectrum
self.assertTrue(np.array_equal(laser_spectrum.wavelengths, spectrum.wavelengths),
"LaserSpectrum.wavelengths values are not equal to Spectrum.wavelengths "
"with same boundaries and number of bins")
"with same boundaries and number of bins")
Loading