6
6
7
7
import numpy as np
8
8
from context import dpdata
9
+
9
10
from dpdata .lammps .dump import get_spin
10
11
11
12
TRAJ_NO_ID = """ITEM: TIMESTEP
@@ -127,7 +128,7 @@ def test_read_dump_spin(self):
127
128
128
129
if os .path .isdir ("lammps/dump" ):
129
130
shutil .rmtree ("lammps/dump" )
130
-
131
+
131
132
def test_read_dump_partial_spin (self ):
132
133
# test if dpdata can read the spins when the spin data is not complete
133
134
with self .assertWarns (UserWarning ) as cm :
@@ -138,12 +139,15 @@ def test_read_dump_partial_spin(self):
138
139
input_file = "lammps/in.lmp" ,
139
140
)
140
141
self .assertTrue ("spins" not in tmp_system .data )
141
-
142
+
142
143
self .assertIn ("Warning: spin info is not found in frame" , str (cm .warning ))
143
-
144
+
144
145
def test_get_spin_failed (self ):
145
146
with self .assertWarns (UserWarning ) as cm :
146
- spin = get_spin (TRAJ_NO_ID .split ("\n " ),["c_spin[1]" , "c_spin[2]" , "c_spin[3]" , "c_spin[4]" ])
147
+ spin = get_spin (
148
+ TRAJ_NO_ID .split ("\n " ),
149
+ ["c_spin[1]" , "c_spin[2]" , "c_spin[3]" , "c_spin[4]" ],
150
+ )
147
151
self .assertTrue (spin is None )
148
-
149
- self .assertIn ("Error processing spin data:" , str (cm .warning ))
152
+
153
+ self .assertIn ("Error processing spin data:" , str (cm .warning ))
0 commit comments