Skip to content

Commit

Permalink
Refactor: Cleaned up sorting and added test for uncovered lines
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Oct 27, 2023
1 parent 64f9436 commit f338bb5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions orix/tests/sampling/test_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
from orix.sampling import (
get_sample_fundamental,
get_sample_local,
uniform_SO3_sample,
get_sample_reduced_fundamental,
get_sample_zone_axis,
uniform_SO3_sample,
)
from orix.sampling.SO3_sampling import _resolution_to_num_steps
from orix.sampling._polyhedral_sampling import (
Expand Down Expand Up @@ -201,7 +201,7 @@ def test_get_sample_reduced_fundamental(self):
np.abs(rotations.size / rotations6.size) - 6 < 0.1
) # about 6 times more rotations

@pytest.mark.parametrize("density", ("3", "7"))
@pytest.mark.parametrize("density", ("3", "7", "5"))
@pytest.mark.parametrize("get_directions", (True, False))
def test_get_zone_axis(self, density, get_directions):
a = 5.431
Expand All @@ -217,10 +217,14 @@ def test_get_zone_axis(self, density, get_directions):
) # Motif part B
struct = Structure(atoms=atom_list, lattice=latt)
p = Phase(structure=struct, space_group=227)
if get_directions:
rot, _ = get_sample_zone_axis(
phase=p, density=density, return_directions=True
)
if density == "5":
with pytest.raises("ValueError"):
get_sample_zone_axis(phase=p, density=density)
else:
rot = get_sample_zone_axis(phase=p, density=density)
assert isinstance(rot, Rotation)
if get_directions:
rot, _ = get_sample_zone_axis(
phase=p, density=density, return_directions=True
)
else:
rot = get_sample_zone_axis(phase=p, density=density)
assert isinstance(rot, Rotation)

0 comments on commit f338bb5

Please sign in to comment.