@@ -126,6 +126,13 @@ def test_init(self, diffraction_calculator: SimulationGenerator):
126
126
assert diffraction_calculator .approximate_precession == True
127
127
assert diffraction_calculator .minimum_intensity == 1e-20
128
128
129
+ def test_repr (self , diffraction_calculator ):
130
+ assert repr (diffraction_calculator ) == (
131
+ "SimulationGenerator(accelerating_voltage=300, "
132
+ "scattering_params=lobato, "
133
+ "approximate_precession=True)"
134
+ )
135
+
129
136
def test_matching_results (
130
137
self , diffraction_calculator : SimulationGenerator , local_structure
131
138
):
@@ -245,35 +252,32 @@ def test_multiphase_multirotation_simulation():
245
252
big_silicon = make_phase (10 )
246
253
rot = Rotation .from_euler ([[0 , 0 , 0 ], [0.1 , 0.1 , 0.1 ]])
247
254
rot2 = Rotation .from_euler ([[0 , 0 , 0 ], [0.1 , 0.1 , 0.1 ], [0.2 , 0.2 , 0.2 ]])
248
- sim = generator .calculate_diffraction2d (
249
- [silicon , big_silicon ], rotation = [rot , rot2 ]
250
- )
255
+ _ = generator .calculate_diffraction2d ([silicon , big_silicon ], rotation = [rot , rot2 ])
251
256
252
257
253
258
def test_multiphase_multirotation_simulation_error ():
254
259
generator = SimulationGenerator (300 )
255
260
silicon = make_phase (5 )
256
261
big_silicon = make_phase (10 )
257
262
rot = Rotation .from_euler ([[0 , 0 , 0 ], [0.1 , 0.1 , 0.1 ]])
258
- rot2 = Rotation .from_euler ([[0 , 0 , 0 ], [0.1 , 0.1 , 0.1 ], [0.2 , 0.2 , 0.2 ]])
263
+ _ = Rotation .from_euler ([[0 , 0 , 0 ], [0.1 , 0.1 , 0.1 ], [0.2 , 0.2 , 0.2 ]])
259
264
with pytest .raises (ValueError ):
260
- sim = generator .calculate_diffraction2d ([silicon , big_silicon ], rotation = [rot ])
265
+ _ = generator .calculate_diffraction2d ([silicon , big_silicon ], rotation = [rot ])
261
266
262
267
263
268
@pytest .mark .parametrize ("scattering_param" , ["lobato" , "xtables" ])
264
269
def test_param_check (scattering_param ):
265
- generator = SimulationGenerator (300 , scattering_params = scattering_param )
270
+ _ = SimulationGenerator (300 , scattering_params = scattering_param )
266
271
267
272
268
- @pytest .mark .xfail (raises = NotImplementedError )
269
273
def test_invalid_scattering_params ():
270
- scattering_param = "_empty"
271
- generator = SimulationGenerator (300 , scattering_params = scattering_param )
274
+ with pytest . raises ( NotImplementedError ):
275
+ _ = SimulationGenerator (300 , scattering_params = "_empty" )
272
276
273
277
274
- @pytest .mark .xfail (faises = NotImplementedError )
275
278
def test_invalid_shape_model ():
276
- generator = SimulationGenerator (300 , shape_factor_model = "dracula" )
279
+ with pytest .raises (NotImplementedError ):
280
+ _ = SimulationGenerator (300 , shape_factor_model = "dracula" )
277
281
278
282
279
283
def test_same_simulation_results ():
0 commit comments