fix pyflakes imported but unused in pytest

This commit is contained in:
f.basile 2020-06-05 13:53:47 +02:00
parent cb1779ef9a
commit 54c20cdd3c
1 changed files with 22 additions and 25 deletions

View File

@ -1,6 +1,3 @@
import os
from itertools import permutations
import pytest
import numpy as np
@ -9,22 +6,22 @@ from damask import Rotation
from damask import Orientation
from damask import Lattice
rot0= damask.Rotation.from_random()
rot1= damask.Rotation.from_random()
rot2= damask.Rotation.from_random()
rot3= damask.Rotation.from_random()
rot0= Rotation.from_random()
rot1= Rotation.from_random()
rot2= Rotation.from_random()
rot3= Rotation.from_random()
class TestOrientation_vec:
@pytest.mark.parametrize('lattice',Lattice.lattices)
def test_equivalentOrientations_vec(self,lattice):
ori0=damask.Orientation(rot0,lattice)
ori1=damask.Orientation(rot1,lattice)
ori2=damask.Orientation(rot2,lattice)
ori3=damask.Orientation(rot3,lattice)
ori0=Orientation(rot0,lattice)
ori1=Orientation(rot1,lattice)
ori2=Orientation(rot2,lattice)
ori3=Orientation(rot3,lattice)
quat=np.array([rot0.as_quaternion(),rot1.as_quaternion(),rot2.as_quaternion(),rot3.as_quaternion()])
rot_vec=damask.Rotation.from_quaternion(quat)
ori_vec=damask.Orientation(rot_vec,lattice)
rot_vec=Rotation.from_quaternion(quat)
ori_vec=Orientation(rot_vec,lattice)
for s in range(len(ori_vec.lattice.symmetry.symmetryOperations())):
assert all(ori_vec.equivalent_vec()[s,0].rotation.as_Eulers() == \
@ -38,18 +35,18 @@ class TestOrientation_vec:
@pytest.mark.parametrize('lattice',Lattice.lattices)
def test_inFZ_vec(self,lattice):
ori0=damask.Orientation(rot0,lattice)
ori1=damask.Orientation(rot1,lattice)
ori2=damask.Orientation(rot2,lattice)
ori3=damask.Orientation(rot3,lattice)
ori0=Orientation(rot0,lattice)
ori1=Orientation(rot1,lattice)
ori2=Orientation(rot2,lattice)
ori3=Orientation(rot3,lattice)
#ensure 1 of them is in FZ
ori4=ori0.reduced()
rot4=ori4.rotation
quat=np.array([rot0.as_quaternion(),rot1.as_quaternion(),\
rot2.as_quaternion(),rot3.as_quaternion(), rot4.as_quaternion()])
rot_vec=damask.Rotation.from_quaternion(quat)
ori_vec=damask.Orientation(rot_vec,lattice)
rot_vec=Rotation.from_quaternion(quat)
ori_vec=Orientation(rot_vec,lattice)
assert ori_vec.inFZ_vec()[0] == ori0.inFZ()
assert ori_vec.inFZ_vec()[1] == ori1.inFZ()
@ -61,14 +58,14 @@ class TestOrientation_vec:
@pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch'])
@pytest.mark.parametrize('lattice',['fcc','bcc'])
def test_relatedOrientations_vec(self,model,lattice):
ori0=damask.Orientation(rot0,lattice)
ori1=damask.Orientation(rot1,lattice)
ori2=damask.Orientation(rot2,lattice)
ori3=damask.Orientation(rot3,lattice)
ori0=Orientation(rot0,lattice)
ori1=Orientation(rot1,lattice)
ori2=Orientation(rot2,lattice)
ori3=Orientation(rot3,lattice)
quat=np.array([rot0.as_quaternion(),rot1.as_quaternion(),rot2.as_quaternion(),rot3.as_quaternion()])
rot_vec=damask.Rotation.from_quaternion(quat)
ori_vec=damask.Orientation(rot_vec,lattice)
rot_vec=Rotation.from_quaternion(quat)
ori_vec=Orientation(rot_vec,lattice)
for s in range(len(ori1.lattice.relationOperations(model)['rotations'])):
assert all(ori_vec.relatedOrientations_vec(model)[s,0].rotation.as_Eulers() == \