Skip to content

Commit

Permalink
TST #68
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 26, 2020
1 parent db2b4c4 commit 6f3300f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hkl/tests/test_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest
import numpy.testing

from .class_fourc import fourc
from hkl import sample


def test_compute_UB(fourc):
fourc.energy.put(8.0)
r1 = fourc.calc.sample.add_reflection(0, 0, 1, (30, 0, 0, 60))
r2 = fourc.calc.sample.add_reflection(0, 1, 1, (45, 45, 0, 90))
result = fourc.calc.sample.compute_UB(r1, r2)
assert result is not None
assert isinstance(result, numpy.ndarray)

r3 = fourc.calc.sample.add_reflection(0, 0, .5, (30/2, 0, 0, 60/2))
del result
with pytest.raises(Exception) as exinfo:
result = fourc.calc.sample.compute_UB(r1, r3)
assert "given reflections are colinear" in str(exinfo.value)

0 comments on commit 6f3300f

Please sign in to comment.