Skip to content

Commit

Permalink
Testing: Increase coverage of simulation1d
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Jan 14, 2024
1 parent 1471bbc commit f31aae4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions diffsims/tests/simulations/test_simulation1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TestSingleSimulation:
@pytest.fixture
def simulation1d(self):
al_phase = make_phase()
al_phase.name = "Al"
hkls = np.array(["100", "110", "111"])
magnitudes = np.array([1, 2, 3])
inten = np.array([1, 2, 3])
Expand Down Expand Up @@ -58,3 +59,11 @@ def test_plot(self, simulation1d, annotate, ax, with_labels):
if ax == "new":
fig, ax = plt.subplots()
fig = simulation1d.plot(annotate_peaks=annotate, ax=ax, with_labels=with_labels)

def test_repr(self, simulation1d):
assert simulation1d.__repr__() == "Simulation1D(name: Al, wavelength: 0.025)"

def test_theta(self, simulation1d):
np.testing.assert_almost_equal(
simulation1d.theta, np.array([0.02499479, 0.0499584, 0.07485985])
)

0 comments on commit f31aae4

Please sign in to comment.